Merge pull request #1953 from mstorsjo/remove-tabs
Remove tabs from multiline comments, public headers, enums and lists of defines
This commit is contained in:
@@ -41,19 +41,19 @@
|
|||||||
|
|
||||||
#include "codec_def.h"
|
#include "codec_def.h"
|
||||||
/* Constants */
|
/* Constants */
|
||||||
#define MAX_TEMPORAL_LAYER_NUM 4
|
#define MAX_TEMPORAL_LAYER_NUM 4
|
||||||
#define MAX_SPATIAL_LAYER_NUM 4
|
#define MAX_SPATIAL_LAYER_NUM 4
|
||||||
#define MAX_QUALITY_LAYER_NUM 4
|
#define MAX_QUALITY_LAYER_NUM 4
|
||||||
|
|
||||||
#define MAX_LAYER_NUM_OF_FRAME 128
|
#define MAX_LAYER_NUM_OF_FRAME 128
|
||||||
#define MAX_NAL_UNITS_IN_LAYER 128 ///< predetermined here, adjust it later if need
|
#define MAX_NAL_UNITS_IN_LAYER 128 ///< predetermined here, adjust it later if need
|
||||||
|
|
||||||
#define MAX_RTP_PAYLOAD_LEN 1000
|
#define MAX_RTP_PAYLOAD_LEN 1000
|
||||||
#define AVERAGE_RTP_PAYLOAD_LEN 800
|
#define AVERAGE_RTP_PAYLOAD_LEN 800
|
||||||
|
|
||||||
|
|
||||||
#define SAVED_NALUNIT_NUM_TMP ( (MAX_SPATIAL_LAYER_NUM*MAX_QUALITY_LAYER_NUM) + 1 + MAX_SPATIAL_LAYER_NUM ) ///< SPS/PPS + SEI/SSEI + PADDING_NAL
|
#define SAVED_NALUNIT_NUM_TMP ( (MAX_SPATIAL_LAYER_NUM*MAX_QUALITY_LAYER_NUM) + 1 + MAX_SPATIAL_LAYER_NUM ) ///< SPS/PPS + SEI/SSEI + PADDING_NAL
|
||||||
#define MAX_SLICES_NUM_TMP ( ( MAX_NAL_UNITS_IN_LAYER - SAVED_NALUNIT_NUM_TMP ) / 3 )
|
#define MAX_SLICES_NUM_TMP ( ( MAX_NAL_UNITS_IN_LAYER - SAVED_NALUNIT_NUM_TMP ) / 3 )
|
||||||
|
|
||||||
|
|
||||||
#define AUTO_REF_PIC_COUNT -1 ///< encoder selects the number of reference frame automatically
|
#define AUTO_REF_PIC_COUNT -1 ///< encoder selects the number of reference frame automatically
|
||||||
@@ -65,10 +65,10 @@
|
|||||||
///
|
///
|
||||||
/// E.g. SDK version is 1.2.0.0, major version number is 1, minor version number is 2, and revision number is 0.
|
/// E.g. SDK version is 1.2.0.0, major version number is 1, minor version number is 2, and revision number is 0.
|
||||||
typedef struct _tagVersion {
|
typedef struct _tagVersion {
|
||||||
unsigned int uMajor; ///< The major version number
|
unsigned int uMajor; ///< The major version number
|
||||||
unsigned int uMinor; ///< The minor version number
|
unsigned int uMinor; ///< The minor version number
|
||||||
unsigned int uRevision; ///< The revision number
|
unsigned int uRevision; ///< The revision number
|
||||||
unsigned int uReserved; ///< The reserved number, it should be 0.
|
unsigned int uReserved; ///< The reserved number, it should be 0.
|
||||||
} OpenH264Version;
|
} OpenH264Version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -148,13 +148,13 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DECODER_OPTION_DATAFORMAT = 0, ///< color format, now supports 23 only (I420)
|
DECODER_OPTION_DATAFORMAT = 0, ///< color format, now supports 23 only (I420)
|
||||||
DECODER_OPTION_END_OF_STREAM, ///< end of stream flag
|
DECODER_OPTION_END_OF_STREAM, ///< end of stream flag
|
||||||
DECODER_OPTION_VCL_NAL, ///< feedback whether or not have VCL NAL in current AU for application layer
|
DECODER_OPTION_VCL_NAL, ///< feedback whether or not have VCL NAL in current AU for application layer
|
||||||
DECODER_OPTION_TEMPORAL_ID, ///< feedback temporal id for application layer
|
DECODER_OPTION_TEMPORAL_ID, ///< feedback temporal id for application layer
|
||||||
DECODER_OPTION_FRAME_NUM, ///< feedback current decoded frame number
|
DECODER_OPTION_FRAME_NUM, ///< feedback current decoded frame number
|
||||||
DECODER_OPTION_IDR_PIC_ID, ///< feedback current frame belong to which IDR period
|
DECODER_OPTION_IDR_PIC_ID, ///< feedback current frame belong to which IDR period
|
||||||
DECODER_OPTION_LTR_MARKING_FLAG, ///< feedback wether current frame mark a LTR
|
DECODER_OPTION_LTR_MARKING_FLAG, ///< feedback wether current frame mark a LTR
|
||||||
DECODER_OPTION_LTR_MARKED_FRAME_NUM, ///< feedback frame num marked by current Frame
|
DECODER_OPTION_LTR_MARKED_FRAME_NUM, ///< feedback frame num marked by current Frame
|
||||||
DECODER_OPTION_ERROR_CON_IDC, ///< not finished yet, indicate decoder error concealment status, in progress
|
DECODER_OPTION_ERROR_CON_IDC, ///< not finished yet, indicate decoder error concealment status, in progress
|
||||||
DECODER_OPTION_TRACE_LEVEL,
|
DECODER_OPTION_TRACE_LEVEL,
|
||||||
DECODER_OPTION_TRACE_CALLBACK, ///< a void (*)(void* context, int level, const char* message) function which receives log messages
|
DECODER_OPTION_TRACE_CALLBACK, ///< a void (*)(void* context, int level, const char* message) function which receives log messages
|
||||||
@@ -267,12 +267,12 @@ typedef struct {
|
|||||||
* @brief Enumerate the type of slice mode
|
* @brief Enumerate the type of slice mode
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SM_SINGLE_SLICE = 0, ///< | SliceNum==1
|
SM_SINGLE_SLICE = 0, ///< | SliceNum==1
|
||||||
SM_FIXEDSLCNUM_SLICE = 1, ///< | according to SliceNum | enabled dynamic slicing for multi-thread
|
SM_FIXEDSLCNUM_SLICE = 1, ///< | according to SliceNum | enabled dynamic slicing for multi-thread
|
||||||
SM_RASTER_SLICE = 2, ///< | according to SlicesAssign | need input of MB numbers each slice. In addition, if other constraint in SSliceArgument is presented, need to follow the constraints. Typically if MB num and slice size are both constrained, re-encoding may be involved.
|
SM_RASTER_SLICE = 2, ///< | according to SlicesAssign | need input of MB numbers each slice. In addition, if other constraint in SSliceArgument is presented, need to follow the constraints. Typically if MB num and slice size are both constrained, re-encoding may be involved.
|
||||||
SM_ROWMB_SLICE = 3, ///< | according to PictureMBHeight | typical of single row of mbs each slice + slice size constraint which including re-encoding
|
SM_ROWMB_SLICE = 3, ///< | according to PictureMBHeight | typical of single row of mbs each slice + slice size constraint which including re-encoding
|
||||||
SM_DYN_SLICE = 4, ///< | according to SliceSize | dynamic slicing (have no idea about slice_nums until encoding current frame)
|
SM_DYN_SLICE = 4, ///< | according to SliceSize | dynamic slicing (have no idea about slice_nums until encoding current frame)
|
||||||
SM_AUTO_SLICE = 5, ///< | according to thread number
|
SM_AUTO_SLICE = 5, ///< | according to thread number
|
||||||
SM_RESERVED = 6
|
SM_RESERVED = 6
|
||||||
} SliceModeEnum;
|
} SliceModeEnum;
|
||||||
|
|
||||||
@@ -292,17 +292,17 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PRO_UNKNOWN = 0,
|
PRO_UNKNOWN = 0,
|
||||||
PRO_BASELINE = 66,
|
PRO_BASELINE = 66,
|
||||||
PRO_MAIN = 77,
|
PRO_MAIN = 77,
|
||||||
PRO_EXTENDED = 88,
|
PRO_EXTENDED = 88,
|
||||||
PRO_HIGH = 100,
|
PRO_HIGH = 100,
|
||||||
PRO_HIGH10 = 110,
|
PRO_HIGH10 = 110,
|
||||||
PRO_HIGH422 = 122,
|
PRO_HIGH422 = 122,
|
||||||
PRO_HIGH444 = 144,
|
PRO_HIGH444 = 144,
|
||||||
PRO_CAVLC444 = 244,
|
PRO_CAVLC444 = 244,
|
||||||
|
|
||||||
PRO_SCALABLE_BASELINE = 83,
|
PRO_SCALABLE_BASELINE = 83,
|
||||||
PRO_SCALABLE_HIGH = 86
|
PRO_SCALABLE_HIGH = 86
|
||||||
} EProfileIdc;
|
} EProfileIdc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -341,7 +341,7 @@ enum {
|
|||||||
WELS_LOG_DETAIL = 1 << 4, ///< per packet/frame log
|
WELS_LOG_DETAIL = 1 << 4, ///< per packet/frame log
|
||||||
WELS_LOG_RESV = 1 << 5, ///< resversed log iLevel
|
WELS_LOG_RESV = 1 << 5, ///< resversed log iLevel
|
||||||
WELS_LOG_LEVEL_COUNT = 6,
|
WELS_LOG_LEVEL_COUNT = 6,
|
||||||
WELS_LOG_DEFAULT = WELS_LOG_WARNING ///< default log iLevel in Wels codec
|
WELS_LOG_DEFAULT = WELS_LOG_WARNING ///< default log iLevel in Wels codec
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -355,10 +355,10 @@ typedef struct {
|
|||||||
* @brief Structure for spatial layer configuration
|
* @brief Structure for spatial layer configuration
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int iVideoWidth; ///< width of picture in luminance samples of a layer
|
int iVideoWidth; ///< width of picture in luminance samples of a layer
|
||||||
int iVideoHeight; ///< height of picture in luminance samples of a layer
|
int iVideoHeight; ///< height of picture in luminance samples of a layer
|
||||||
float fFrameRate; ///< frame rate specified for a layer
|
float fFrameRate; ///< frame rate specified for a layer
|
||||||
int iSpatialBitrate; ///< target bitrate for a spatial layer
|
int iSpatialBitrate; ///< target bitrate for a spatial layer
|
||||||
int iMaxSpatialBitrate; ///< maximum bitrate for a spatial layer
|
int iMaxSpatialBitrate; ///< maximum bitrate for a spatial layer
|
||||||
EProfileIdc uiProfileIdc; ///< value of profile IDC (PRO_UNKNOWN for auto-detection)
|
EProfileIdc uiProfileIdc; ///< value of profile IDC (PRO_UNKNOWN for auto-detection)
|
||||||
ELevelIdc uiLevelIdc; ///< value of profile IDC (0 for auto-detection)
|
ELevelIdc uiLevelIdc; ///< value of profile IDC (0 for auto-detection)
|
||||||
@@ -406,7 +406,7 @@ typedef struct TagEncParamBase {
|
|||||||
|
|
||||||
int iPicWidth; ///< width of picture in luminance samples (the maximum of all layers if multiple spatial layers presents)
|
int iPicWidth; ///< width of picture in luminance samples (the maximum of all layers if multiple spatial layers presents)
|
||||||
int iPicHeight; ///< height of picture in luminance samples((the maximum of all layers if multiple spatial layers presents)
|
int iPicHeight; ///< height of picture in luminance samples((the maximum of all layers if multiple spatial layers presents)
|
||||||
int iTargetBitrate; ///< target bitrate desired
|
int iTargetBitrate; ///< target bitrate desired
|
||||||
RC_MODES iRCMode; ///< rate control mode
|
RC_MODES iRCMode; ///< rate control mode
|
||||||
float fMaxFrameRate; ///< maximal input frame rate
|
float fMaxFrameRate; ///< maximal input frame rate
|
||||||
|
|
||||||
@@ -420,7 +420,7 @@ typedef struct TagEncParamExt {
|
|||||||
iUsageType; ///< application type;1.CAMERA_VIDEO_REAL_TIME:camera video signal;2.SCREEN_CONTENT_REAL_TIME:screen content signal;
|
iUsageType; ///< application type;1.CAMERA_VIDEO_REAL_TIME:camera video signal;2.SCREEN_CONTENT_REAL_TIME:screen content signal;
|
||||||
|
|
||||||
int iPicWidth; ///< width of picture in luminance samples (the maximum of all layers if multiple spatial layers presents)
|
int iPicWidth; ///< width of picture in luminance samples (the maximum of all layers if multiple spatial layers presents)
|
||||||
int iPicHeight; ///< height of picture in luminance samples((the maximum of all layers if multiple spatial layers presents)
|
int iPicHeight; ///< height of picture in luminance samples((the maximum of all layers if multiple spatial layers presents)
|
||||||
int iTargetBitrate; ///< target bitrate desired
|
int iTargetBitrate; ///< target bitrate desired
|
||||||
RC_MODES iRCMode; ///< rate control mode
|
RC_MODES iRCMode; ///< rate control mode
|
||||||
float fMaxFrameRate; ///< maximal input frame rate
|
float fMaxFrameRate; ///< maximal input frame rate
|
||||||
@@ -458,7 +458,7 @@ typedef struct TagEncParamExt {
|
|||||||
/* Deblocking loop filter */
|
/* Deblocking loop filter */
|
||||||
int iLoopFilterDisableIdc; ///< 0: on, 1: off, 2: on except for slice boundaries
|
int iLoopFilterDisableIdc; ///< 0: on, 1: off, 2: on except for slice boundaries
|
||||||
int iLoopFilterAlphaC0Offset; ///< AlphaOffset: valid range [-6, 6], default 0
|
int iLoopFilterAlphaC0Offset; ///< AlphaOffset: valid range [-6, 6], default 0
|
||||||
int iLoopFilterBetaOffset; ///< BetaOffset: valid range [-6, 6], default 0
|
int iLoopFilterBetaOffset; ///< BetaOffset: valid range [-6, 6], default 0
|
||||||
/*pre-processing feature*/
|
/*pre-processing feature*/
|
||||||
bool bEnableDenoise; ///< denoise control
|
bool bEnableDenoise; ///< denoise control
|
||||||
bool bEnableBackgroundDetection; ///< background detection control //VAA_BACKGROUND_DETECTION //BGD cmd
|
bool bEnableBackgroundDetection; ///< background detection control //VAA_BACKGROUND_DETECTION //BGD cmd
|
||||||
@@ -481,11 +481,11 @@ typedef struct {
|
|||||||
* @brief SVC Decoding Parameters, reserved here and potential applicable in the future
|
* @brief SVC Decoding Parameters, reserved here and potential applicable in the future
|
||||||
*/
|
*/
|
||||||
typedef struct TagSVCDecodingParam {
|
typedef struct TagSVCDecodingParam {
|
||||||
char* pFileNameRestructed; ///< file name of reconstructed frame used for PSNR calculation based debug
|
char* pFileNameRestructed; ///< file name of reconstructed frame used for PSNR calculation based debug
|
||||||
|
|
||||||
EVideoFormatType eOutputColorFormat; ///< color space format to be outputed, EVideoFormatType specified in codec_def.h
|
EVideoFormatType eOutputColorFormat; ///< color space format to be outputed, EVideoFormatType specified in codec_def.h
|
||||||
unsigned int uiCpuLoad; ///< CPU load
|
unsigned int uiCpuLoad; ///< CPU load
|
||||||
unsigned char uiTargetDqLayer; ///< setting target dq layer id
|
unsigned char uiTargetDqLayer; ///< setting target dq layer id
|
||||||
|
|
||||||
ERROR_CON_IDC eEcActiveIdc; ///< whether active error concealment feature in decoder
|
ERROR_CON_IDC eEcActiveIdc; ///< whether active error concealment feature in decoder
|
||||||
bool bParseOnly; ///< decoder for parse only, no reconstruction. When it is true, SPS/PPS size should not exceed SPS_PPS_BS_SIZE (128). Otherwise, it will return error info
|
bool bParseOnly; ///< decoder for parse only, no reconstruction. When it is true, SPS/PPS size should not exceed SPS_PPS_BS_SIZE (128). Otherwise, it will return error info
|
||||||
@@ -504,27 +504,27 @@ typedef struct {
|
|||||||
unsigned char uiLayerType;
|
unsigned char uiLayerType;
|
||||||
|
|
||||||
int iNalCount; ///< count number of NAL coded already
|
int iNalCount; ///< count number of NAL coded already
|
||||||
int* pNalLengthInByte; ///< length of NAL size in byte from 0 to iNalCount-1
|
int* pNalLengthInByte; ///< length of NAL size in byte from 0 to iNalCount-1
|
||||||
unsigned char* pBsBuf; ///< buffer of bitstream contained
|
unsigned char* pBsBuf; ///< buffer of bitstream contained
|
||||||
} SLayerBSInfo, *PLayerBSInfo;
|
} SLayerBSInfo, *PLayerBSInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Frame bit stream info
|
* @brief Frame bit stream info
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int iTemporalId; ///< temporal ID
|
int iTemporalId; ///< temporal ID
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The sub sequence layers are ordered hierarchically based on their dependency on each other so that any picture in a layer shall not be
|
* The sub sequence layers are ordered hierarchically based on their dependency on each other so that any picture in a layer shall not be
|
||||||
* predicted from any picture on any higher layer.
|
* predicted from any picture on any higher layer.
|
||||||
*/
|
*/
|
||||||
int iSubSeqId; ///< refer to D.2.11 Sub-sequence information SEI message semantics
|
int iSubSeqId; ///< refer to D.2.11 Sub-sequence information SEI message semantics
|
||||||
|
|
||||||
int iLayerNum;
|
int iLayerNum;
|
||||||
SLayerBSInfo sLayerInfo[MAX_LAYER_NUM_OF_FRAME];
|
SLayerBSInfo sLayerInfo[MAX_LAYER_NUM_OF_FRAME];
|
||||||
|
|
||||||
EVideoFrameType eFrameType;
|
EVideoFrameType eFrameType;
|
||||||
int iFrameSizeInBytes;
|
int iFrameSizeInBytes;
|
||||||
long long uiTimeStamp;
|
long long uiTimeStamp;
|
||||||
} SFrameBSInfo, *PFrameBSInfo;
|
} SFrameBSInfo, *PFrameBSInfo;
|
||||||
|
|
||||||
@@ -532,9 +532,9 @@ typedef struct {
|
|||||||
* @brief Structure for source picture
|
* @brief Structure for source picture
|
||||||
*/
|
*/
|
||||||
typedef struct Source_Picture_s {
|
typedef struct Source_Picture_s {
|
||||||
int iColorFormat; ///< color space type
|
int iColorFormat; ///< color space type
|
||||||
int iStride[4]; ///< stride for each plane pData
|
int iStride[4]; ///< stride for each plane pData
|
||||||
unsigned char* pData[4]; ///< plane pData
|
unsigned char* pData[4]; ///< plane pData
|
||||||
int iPicWidth; ///< luma picture width in x coordinate
|
int iPicWidth; ///< luma picture width in x coordinate
|
||||||
int iPicHeight; ///< luma picture height in y coordinate
|
int iPicHeight; ///< luma picture height in y coordinate
|
||||||
long long uiTimeStamp;
|
long long uiTimeStamp;
|
||||||
@@ -640,31 +640,30 @@ typedef struct TagVideoEncoderStatistics {
|
|||||||
* @brief Structure for decoder statistics
|
* @brief Structure for decoder statistics
|
||||||
*/
|
*/
|
||||||
typedef struct TagVideoDecoderStatistics {
|
typedef struct TagVideoDecoderStatistics {
|
||||||
unsigned int uiWidth; ///< the width of encode/decode frame
|
unsigned int uiWidth; ///< the width of encode/decode frame
|
||||||
unsigned int uiHeight; ///< the height of encode/decode frame
|
unsigned int uiHeight; ///< the height of encode/decode frame
|
||||||
float fAverageFrameSpeedInMs; ///< average_Decoding_Time
|
float fAverageFrameSpeedInMs; ///< average_Decoding_Time
|
||||||
float fActualAverageFrameSpeedInMs; ///< actual average_Decoding_Time, including freezing pictures
|
float fActualAverageFrameSpeedInMs; ///< actual average_Decoding_Time, including freezing pictures
|
||||||
unsigned int uiDecodedFrameCount; ///< number of frames
|
unsigned int uiDecodedFrameCount; ///< number of frames
|
||||||
unsigned int uiResolutionChangeTimes; ///< uiResolutionChangeTimes
|
unsigned int uiResolutionChangeTimes; ///< uiResolutionChangeTimes
|
||||||
unsigned int uiIDRCorrectNum; ///< number of correct IDR received
|
unsigned int uiIDRCorrectNum; ///< number of correct IDR received
|
||||||
//EC on related
|
//EC on related
|
||||||
unsigned int
|
unsigned int
|
||||||
uiAvgEcRatio; ///< when EC is on, the average ratio of total EC areas, can be an indicator of reconstruction quality
|
uiAvgEcRatio; ///< when EC is on, the average ratio of total EC areas, can be an indicator of reconstruction quality
|
||||||
unsigned int
|
unsigned int
|
||||||
uiAvgEcPropRatio; ///< when EC is on, the rough average ratio of propogate EC areas, can be an indicator of reconstruction quality
|
uiAvgEcPropRatio; ///< when EC is on, the rough average ratio of propogate EC areas, can be an indicator of reconstruction quality
|
||||||
unsigned int uiEcIDRNum; ///< number of actual unintegrity IDR or not received but eced
|
unsigned int uiEcIDRNum; ///< number of actual unintegrity IDR or not received but eced
|
||||||
unsigned int uiEcFrameNum; ///<
|
unsigned int uiEcFrameNum; ///<
|
||||||
unsigned int uiIDRLostNum; ///< number of whole lost IDR
|
unsigned int uiIDRLostNum; ///< number of whole lost IDR
|
||||||
unsigned int
|
unsigned int uiFreezingIDRNum; ///< number of freezing IDR with error (partly received), under resolution change
|
||||||
uiFreezingIDRNum; ///< number of freezing IDR with error (partly received), under resolution change
|
|
||||||
unsigned int uiFreezingNonIDRNum; ///< number of freezing non-IDR with error
|
unsigned int uiFreezingNonIDRNum; ///< number of freezing non-IDR with error
|
||||||
int iAvgLumaQp; ///< average luma QP. default: -1, no correct frame outputted
|
int iAvgLumaQp; ///< average luma QP. default: -1, no correct frame outputted
|
||||||
int iSpsReportErrorNum; ///< number of Sps Invalid report
|
int iSpsReportErrorNum; ///< number of Sps Invalid report
|
||||||
int iSubSpsReportErrorNum; ///< number of SubSps Invalid report
|
int iSubSpsReportErrorNum; ///< number of SubSps Invalid report
|
||||||
int iPpsReportErrorNum; ///< number of Pps Invalid report
|
int iPpsReportErrorNum; ///< number of Pps Invalid report
|
||||||
int iSpsNoExistNalNum; ///< number of Sps NoExist Nal
|
int iSpsNoExistNalNum; ///< number of Sps NoExist Nal
|
||||||
int iSubSpsNoExistNalNum; ///< number of SubSps NoExist Nal
|
int iSubSpsNoExistNalNum; ///< number of SubSps NoExist Nal
|
||||||
int iPpsNoExistNalNum; ///< number of Pps NoExist Nal
|
int iPpsNoExistNalNum; ///< number of Pps NoExist Nal
|
||||||
} SDecoderStatistics; // in building, coming soon
|
} SDecoderStatistics; // in building, coming soon
|
||||||
|
|
||||||
#endif//WELS_VIDEO_CODEC_APPLICATION_DEFINITION_H__
|
#endif//WELS_VIDEO_CODEC_APPLICATION_DEFINITION_H__
|
||||||
|
|||||||
@@ -118,8 +118,8 @@ enum ENalPriority {
|
|||||||
#define IS_IDR_NAL(eNalRefIdc, eNalType) \
|
#define IS_IDR_NAL(eNalRefIdc, eNalType) \
|
||||||
( (eNalRefIdc == NAL_PRIORITY_HIGHEST) && (eNalType == NAL_SLICE_IDR) )
|
( (eNalRefIdc == NAL_PRIORITY_HIGHEST) && (eNalType == NAL_SLICE_IDR) )
|
||||||
|
|
||||||
#define FRAME_NUM_PARAM_SET (-1)
|
#define FRAME_NUM_PARAM_SET (-1)
|
||||||
#define FRAME_NUM_IDR 0
|
#define FRAME_NUM_IDR 0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief eDeblockingIdc
|
* @brief eDeblockingIdc
|
||||||
@@ -146,7 +146,7 @@ enum {
|
|||||||
ET_IR_R2 = 0x08, ///< Intra Refresh in predifined 5% MB
|
ET_IR_R2 = 0x08, ///< Intra Refresh in predifined 5% MB
|
||||||
ET_IR_R3 = 0x10, ///< Intra Refresh in predifined 10% MB
|
ET_IR_R3 = 0x10, ///< Intra Refresh in predifined 10% MB
|
||||||
ET_FEC_HALF = 0x20, ///< Forward Error Correction in 50% redundency mode
|
ET_FEC_HALF = 0x20, ///< Forward Error Correction in 50% redundency mode
|
||||||
ET_FEC_FULL = 0x40, ///< Forward Error Correction in 100% redundency mode
|
ET_FEC_FULL = 0x40, ///< Forward Error Correction in 100% redundency mode
|
||||||
ET_RFS = 0x80 ///< Reference Frame Selection
|
ET_RFS = 0x80 ///< Reference Frame Selection
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -154,15 +154,15 @@ enum {
|
|||||||
* @brief Information of coded Slice(=NAL)(s)
|
* @brief Information of coded Slice(=NAL)(s)
|
||||||
*/
|
*/
|
||||||
typedef struct SliceInformation {
|
typedef struct SliceInformation {
|
||||||
unsigned char* pBufferOfSlices; ///< base buffer of coded slice(s)
|
unsigned char* pBufferOfSlices; ///< base buffer of coded slice(s)
|
||||||
int iCodedSliceCount; ///< number of coded slices
|
int iCodedSliceCount; ///< number of coded slices
|
||||||
unsigned int* pLengthOfSlices; ///< array of slices length accordingly by number of slice
|
unsigned int* pLengthOfSlices; ///< array of slices length accordingly by number of slice
|
||||||
int iFecType; ///< FEC type[0, 50%FEC, 100%FEC]
|
int iFecType; ///< FEC type[0, 50%FEC, 100%FEC]
|
||||||
unsigned char uiSliceIdx; ///< index of slice in frame [FMO: 0,..,uiSliceCount-1; No FMO: 0]
|
unsigned char uiSliceIdx; ///< index of slice in frame [FMO: 0,..,uiSliceCount-1; No FMO: 0]
|
||||||
unsigned char uiSliceCount; ///< count number of slice in frame [FMO: 2-8; No FMO: 1]
|
unsigned char uiSliceCount; ///< count number of slice in frame [FMO: 2-8; No FMO: 1]
|
||||||
char iFrameIndex; ///< index of frame[-1, .., idr_interval-1]
|
char iFrameIndex; ///< index of frame[-1, .., idr_interval-1]
|
||||||
unsigned char uiNalRefIdc; ///< NRI, priority level of slice(NAL)
|
unsigned char uiNalRefIdc; ///< NRI, priority level of slice(NAL)
|
||||||
unsigned char uiNalType; ///< NAL type
|
unsigned char uiNalType; ///< NAL type
|
||||||
unsigned char
|
unsigned char
|
||||||
uiContainingFinalNal; ///< whether final NAL is involved in buffer of coded slices, flag used in Pause feature in T27
|
uiContainingFinalNal; ///< whether final NAL is involved in buffer of coded slices, flag used in Pause feature in T27
|
||||||
} SliceInfo, *PSliceInfo;
|
} SliceInfo, *PSliceInfo;
|
||||||
|
|||||||
@@ -93,11 +93,11 @@ typedef struct _WelsLogicalProcessorInfo {
|
|||||||
int32_t ProcessorCount;
|
int32_t ProcessorCount;
|
||||||
} WelsLogicalProcessInfo;
|
} WelsLogicalProcessInfo;
|
||||||
|
|
||||||
#define WELS_THREAD_ERROR_OK 0
|
#define WELS_THREAD_ERROR_OK 0
|
||||||
#define WELS_THREAD_ERROR_GENERAL ((uint32_t)(-1))
|
#define WELS_THREAD_ERROR_GENERAL ((uint32_t)(-1))
|
||||||
#define WELS_THREAD_ERROR_WAIT_OBJECT_0 0
|
#define WELS_THREAD_ERROR_WAIT_OBJECT_0 0
|
||||||
#define WELS_THREAD_ERROR_WAIT_TIMEOUT ((uint32_t)0x00000102L)
|
#define WELS_THREAD_ERROR_WAIT_TIMEOUT ((uint32_t)0x00000102L)
|
||||||
#define WELS_THREAD_ERROR_WAIT_FAILED WELS_THREAD_ERROR_GENERAL
|
#define WELS_THREAD_ERROR_WAIT_FAILED WELS_THREAD_ERROR_GENERAL
|
||||||
|
|
||||||
WELS_THREAD_ERROR_CODE WelsMutexInit (WELS_MUTEX* mutex);
|
WELS_THREAD_ERROR_CODE WelsMutexInit (WELS_MUTEX* mutex);
|
||||||
WELS_THREAD_ERROR_CODE WelsMutexLock (WELS_MUTEX* mutex);
|
WELS_THREAD_ERROR_CODE WelsMutexLock (WELS_MUTEX* mutex);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ extern "C" {
|
|||||||
|
|
||||||
#if defined(X86_ASM)
|
#if defined(X86_ASM)
|
||||||
/*
|
/*
|
||||||
* cpuid support verify routine
|
* cpuid support verify routine
|
||||||
* return 0 if cpuid is not supported by cpu
|
* return 0 if cpuid is not supported by cpu
|
||||||
*/
|
*/
|
||||||
int32_t WelsCPUIdVerify();
|
int32_t WelsCPUIdVerify();
|
||||||
@@ -63,7 +63,7 @@ int32_t WelsCPUSupportFMA (uint32_t eax, uint32_t ecx);
|
|||||||
void WelsEmms();
|
void WelsEmms();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* clear FPU registers states for potential float based calculation if support
|
* clear FPU registers states for potential float based calculation if support
|
||||||
*/
|
*/
|
||||||
void WelsCPURestore (const uint32_t kuiCPU);
|
void WelsCPURestore (const uint32_t kuiCPU);
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
#define WELS_CPU_CORE_FEATURE_DETECTION_H__
|
#define WELS_CPU_CORE_FEATURE_DETECTION_H__
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* WELS CPU feature flags
|
* WELS CPU feature flags
|
||||||
*/
|
*/
|
||||||
#define WELS_CPU_MMX 0x00000001 /* mmx */
|
#define WELS_CPU_MMX 0x00000001 /* mmx */
|
||||||
#define WELS_CPU_MMXEXT 0x00000002 /* mmx-ext*/
|
#define WELS_CPU_MMXEXT 0x00000002 /* mmx-ext*/
|
||||||
@@ -56,18 +56,18 @@
|
|||||||
#define WELS_CPU_SSE42 0x00000400 /* sse 4.2 */
|
#define WELS_CPU_SSE42 0x00000400 /* sse 4.2 */
|
||||||
|
|
||||||
/* CPU features application extensive */
|
/* CPU features application extensive */
|
||||||
#define WELS_CPU_AVX 0x00000800 /* Advanced Vector eXtentions */
|
#define WELS_CPU_AVX 0x00000800 /* Advanced Vector eXtentions */
|
||||||
#define WELS_CPU_FPU 0x00001000 /* x87-FPU on chip */
|
#define WELS_CPU_FPU 0x00001000 /* x87-FPU on chip */
|
||||||
#define WELS_CPU_HTT 0x00002000 /* Hyper-Threading Technology (HTT), Multi-threading enabled feature:
|
#define WELS_CPU_HTT 0x00002000 /* Hyper-Threading Technology (HTT), Multi-threading enabled feature:
|
||||||
physical processor package is capable of supporting more than one logic processor
|
physical processor package is capable of supporting more than one logic processor
|
||||||
*/
|
*/
|
||||||
#define WELS_CPU_CMOV 0x00004000 /* Conditional Move Instructions,
|
#define WELS_CPU_CMOV 0x00004000 /* Conditional Move Instructions,
|
||||||
also if x87-FPU is present at indicated by the CPUID.FPU feature bit, then FCOMI and FCMOV are supported
|
also if x87-FPU is present at indicated by the CPUID.FPU feature bit, then FCOMI and FCMOV are supported
|
||||||
*/
|
*/
|
||||||
#define WELS_CPU_MOVBE 0x00008000 /* MOVBE instruction */
|
#define WELS_CPU_MOVBE 0x00008000 /* MOVBE instruction */
|
||||||
#define WELS_CPU_AES 0x00010000 /* AES instruction extensions */
|
#define WELS_CPU_AES 0x00010000 /* AES instruction extensions */
|
||||||
#define WELS_CPU_FMA 0x00020000 /* AVX VEX FMA instruction sets */
|
#define WELS_CPU_FMA 0x00020000 /* AVX VEX FMA instruction sets */
|
||||||
#define WELS_CPU_AVX2 0x00040000 /* AVX2 */
|
#define WELS_CPU_AVX2 0x00040000 /* AVX2 */
|
||||||
|
|
||||||
#define WELS_CPU_CACHELINE_16 0x10000000 /* CacheLine Size 16 */
|
#define WELS_CPU_CACHELINE_16 0x10000000 /* CacheLine Size 16 */
|
||||||
#define WELS_CPU_CACHELINE_32 0x20000000 /* CacheLine Size 32 */
|
#define WELS_CPU_CACHELINE_32 0x20000000 /* CacheLine Size 32 */
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
#define WELS_CPU_NEON 0x000004 /* NEON */
|
#define WELS_CPU_NEON 0x000004 /* NEON */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Interfaces for CPU core feature detection as below
|
* Interfaces for CPU core feature detection as below
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif//WELS_CPU_CORE_FEATURE_DETECTION_H__
|
#endif//WELS_CPU_CORE_FEATURE_DETECTION_H__
|
||||||
|
|||||||
@@ -56,13 +56,13 @@ namespace WelsCommon {
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief initialize bitstream writing
|
* \brief initialize bitstream writing
|
||||||
*
|
*
|
||||||
* \param pBs Bit string auxiliary pointer
|
* \param pBs Bit string auxiliary pointer
|
||||||
* \param pBuf bit-stream pBuffer
|
* \param pBuf bit-stream pBuffer
|
||||||
* \param iSize iSize in bits for decoder; iSize in bytes for encoder
|
* \param iSize iSize in bits for decoder; iSize in bytes for encoder
|
||||||
*
|
*
|
||||||
* \return iSize of pBuffer pData in byte; failed in -1 return
|
* \return iSize of pBuffer pData in byte; failed in -1 return
|
||||||
*/
|
*/
|
||||||
static inline int32_t InitBits (SBitStringAux* pBs, const uint8_t* kpBuf, const int32_t kiSize) {
|
static inline int32_t InitBits (SBitStringAux* pBs, const uint8_t* kpBuf, const int32_t kiSize) {
|
||||||
uint8_t* ptr = (uint8_t*)kpBuf;
|
uint8_t* ptr = (uint8_t*)kpBuf;
|
||||||
@@ -92,7 +92,7 @@ static inline int32_t BsWriteBits (PBitStringAux pBitString, int32_t iLen, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write 1 bit
|
* Write 1 bit
|
||||||
*/
|
*/
|
||||||
static inline int32_t BsWriteOneBit (PBitStringAux pBitString, const uint32_t kuiValue) {
|
static inline int32_t BsWriteOneBit (PBitStringAux pBitString, const uint32_t kuiValue) {
|
||||||
BsWriteBits (pBitString, 1, kuiValue);
|
BsWriteBits (pBitString, 1, kuiValue);
|
||||||
@@ -108,7 +108,7 @@ static inline int32_t BsFlush (PBitStringAux pBitString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write unsigned exp golomb codes
|
* Write unsigned exp golomb codes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static inline int32_t BsWriteUE (PBitStringAux pBitString, const uint32_t kuiValue) {
|
static inline int32_t BsWriteUE (PBitStringAux pBitString, const uint32_t kuiValue) {
|
||||||
@@ -135,7 +135,7 @@ static inline int32_t BsWriteUE (PBitStringAux pBitString, const uint32_t kuiVal
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write signed exp golomb codes
|
* Write signed exp golomb codes
|
||||||
*/
|
*/
|
||||||
static inline int32_t BsWriteSE (PBitStringAux pBitString, const int32_t kiValue) {
|
static inline int32_t BsWriteSE (PBitStringAux pBitString, const int32_t kiValue) {
|
||||||
uint32_t iTmpValue;
|
uint32_t iTmpValue;
|
||||||
@@ -153,7 +153,7 @@ static inline int32_t BsWriteSE (PBitStringAux pBitString, const int32_t kiValue
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write RBSP trailing bits
|
* Write RBSP trailing bits
|
||||||
*/
|
*/
|
||||||
static inline int32_t BsRbspTrailingBits (PBitStringAux pBitString) {
|
static inline int32_t BsRbspTrailingBits (PBitStringAux pBitString) {
|
||||||
BsWriteOneBit (pBitString, 1);
|
BsWriteOneBit (pBitString, 1);
|
||||||
|
|||||||
@@ -207,8 +207,8 @@ template<typename T> T WelsClip3(T iX, T iY, T iZ) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Description: to check variable validation and return the specified result
|
* Description: to check variable validation and return the specified result
|
||||||
* iResult: value to be checked
|
* iResult: value to be checked
|
||||||
* iExpected: the expected value
|
* iExpected: the expected value
|
||||||
*/
|
*/
|
||||||
#ifndef WELS_VERIFY_RETURN_IFNEQ
|
#ifndef WELS_VERIFY_RETURN_IFNEQ
|
||||||
#define WELS_VERIFY_RETURN_IFNEQ(iResult, iExpected) \
|
#define WELS_VERIFY_RETURN_IFNEQ(iResult, iExpected) \
|
||||||
@@ -219,8 +219,8 @@ template<typename T> T WelsClip3(T iX, T iY, T iZ) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Description: to check variable validation and return the specified result
|
* Description: to check variable validation and return the specified result
|
||||||
* iResult: value to be return
|
* iResult: value to be return
|
||||||
* bCaseIf: negative condition to be verified
|
* bCaseIf: negative condition to be verified
|
||||||
*/
|
*/
|
||||||
#ifndef WELS_VERIFY_RETURN_IF
|
#ifndef WELS_VERIFY_RETURN_IF
|
||||||
#define WELS_VERIFY_RETURN_IF(iResult, bCaseIf) \
|
#define WELS_VERIFY_RETURN_IF(iResult, bCaseIf) \
|
||||||
@@ -230,11 +230,11 @@ template<typename T> T WelsClip3(T iX, T iY, T iZ) {
|
|||||||
#endif//#if WELS_VERIFY_RETURN_IF
|
#endif//#if WELS_VERIFY_RETURN_IF
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Description: to check variable validation and return the specified result
|
* Description: to check variable validation and return the specified result
|
||||||
* with correspoinding process advance.
|
* with correspoinding process advance.
|
||||||
* result: value to be return
|
* result: value to be return
|
||||||
* case_if: negative condition to be verified
|
* case_if: negative condition to be verified
|
||||||
* proc: process need perform
|
* proc: process need perform
|
||||||
*/
|
*/
|
||||||
#ifndef WELS_VERIFY_RETURN_PROC_IF
|
#ifndef WELS_VERIFY_RETURN_PROC_IF
|
||||||
#define WELS_VERIFY_RETURN_PROC_IF(iResult, bCaseIf, fProc) \
|
#define WELS_VERIFY_RETURN_PROC_IF(iResult, bCaseIf, fProc) \
|
||||||
|
|||||||
@@ -55,9 +55,9 @@ extern "C" {
|
|||||||
#endif//__cplusplus
|
#endif//__cplusplus
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief time cost measure utilization
|
* \brief time cost measure utilization
|
||||||
* \param void
|
* \param void
|
||||||
* \return time elapsed since run (unit: microsecond)
|
* \return time elapsed since run (unit: microsecond)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static inline int64_t WelsTime (void) {
|
static inline int64_t WelsTime (void) {
|
||||||
|
|||||||
@@ -42,11 +42,11 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
|
|
||||||
#define MAX_LOG_SIZE 1024
|
#define MAX_LOG_SIZE 1024
|
||||||
#define MAX_WIDTH (4096)
|
#define MAX_WIDTH (4096)
|
||||||
#define MAX_HEIGHT (2304)//MAX_FS_LEVEL51 (36864); MAX_FS_LEVEL51*256/4096 = 2304
|
#define MAX_HEIGHT (2304)//MAX_FS_LEVEL51 (36864); MAX_FS_LEVEL51*256/4096 = 2304
|
||||||
/*
|
/*
|
||||||
* Function pointer declaration for various tool sets
|
* Function pointer declaration for various tool sets
|
||||||
*/
|
*/
|
||||||
// wels log output
|
// wels log output
|
||||||
typedef void (*PWelsLogCallbackFunc) (void* pCtx, const int32_t iLevel, const char* kpFmt, va_list argv);
|
typedef void (*PWelsLogCallbackFunc) (void* pCtx, const int32_t iLevel, const char* kpFmt, va_list argv);
|
||||||
@@ -67,22 +67,22 @@ extern void WelsLog (SLogContext* pCtx, int32_t iLevel, const char* kpFmt, ...);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PSNR calculation routines
|
* PSNR calculation routines
|
||||||
*/
|
*/
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief PSNR calculation utilization in Wels
|
* \brief PSNR calculation utilization in Wels
|
||||||
*
|
*
|
||||||
* \param kpTarPic target picture to be calculated in Picture pData format
|
* \param kpTarPic target picture to be calculated in Picture pData format
|
||||||
* \param kiTarStride stride of target picture pData pBuffer
|
* \param kiTarStride stride of target picture pData pBuffer
|
||||||
* \param kpRefPic base referencing picture samples
|
* \param kpRefPic base referencing picture samples
|
||||||
* \param kiRefStride stride of reference picture pData pBuffer
|
* \param kiRefStride stride of reference picture pData pBuffer
|
||||||
* \param kiWidth picture iWidth in pixel
|
* \param kiWidth picture iWidth in pixel
|
||||||
* \param kiHeight picture iHeight in pixel
|
* \param kiHeight picture iHeight in pixel
|
||||||
*
|
*
|
||||||
* \return actual PSNR result;
|
* \return actual PSNR result;
|
||||||
*
|
*
|
||||||
* \note N/A
|
* \note N/A
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
float WelsCalcPsnr (const void* kpTarPic,
|
float WelsCalcPsnr (const void* kpTarPic,
|
||||||
|
|||||||
@@ -78,52 +78,52 @@ extern const int8_t g_kiCabacGlobalContextIdx[WELS_CONTEXT_COUNT][4][2];
|
|||||||
extern const uint8_t g_kuiStateTransTable[64][2];
|
extern const uint8_t g_kuiStateTransTable[64][2];
|
||||||
extern const uint32_t g_kuiGolombUELength[256];
|
extern const uint32_t g_kuiGolombUELength[256];
|
||||||
/*
|
/*
|
||||||
* NAL Unit Type (5 Bits)
|
* NAL Unit Type (5 Bits)
|
||||||
*/
|
*/
|
||||||
enum EWelsNalUnitType {
|
enum EWelsNalUnitType {
|
||||||
NAL_UNIT_UNSPEC_0 = 0,
|
NAL_UNIT_UNSPEC_0 = 0,
|
||||||
NAL_UNIT_CODED_SLICE = 1,
|
NAL_UNIT_CODED_SLICE = 1,
|
||||||
NAL_UNIT_CODED_SLICE_DPA = 2,
|
NAL_UNIT_CODED_SLICE_DPA = 2,
|
||||||
NAL_UNIT_CODED_SLICE_DPB = 3,
|
NAL_UNIT_CODED_SLICE_DPB = 3,
|
||||||
NAL_UNIT_CODED_SLICE_DPC = 4,
|
NAL_UNIT_CODED_SLICE_DPC = 4,
|
||||||
NAL_UNIT_CODED_SLICE_IDR = 5,
|
NAL_UNIT_CODED_SLICE_IDR = 5,
|
||||||
NAL_UNIT_SEI = 6,
|
NAL_UNIT_SEI = 6,
|
||||||
NAL_UNIT_SPS = 7,
|
NAL_UNIT_SPS = 7,
|
||||||
NAL_UNIT_PPS = 8,
|
NAL_UNIT_PPS = 8,
|
||||||
NAL_UNIT_AU_DELIMITER = 9,
|
NAL_UNIT_AU_DELIMITER = 9,
|
||||||
NAL_UNIT_END_OF_SEQ = 10,
|
NAL_UNIT_END_OF_SEQ = 10,
|
||||||
NAL_UNIT_END_OF_STR = 11,
|
NAL_UNIT_END_OF_STR = 11,
|
||||||
NAL_UNIT_FILLER_DATA = 12,
|
NAL_UNIT_FILLER_DATA = 12,
|
||||||
NAL_UNIT_SPS_EXT = 13,
|
NAL_UNIT_SPS_EXT = 13,
|
||||||
NAL_UNIT_PREFIX = 14,
|
NAL_UNIT_PREFIX = 14,
|
||||||
NAL_UNIT_SUBSET_SPS = 15,
|
NAL_UNIT_SUBSET_SPS = 15,
|
||||||
NAL_UNIT_RESV_16 = 16,
|
NAL_UNIT_RESV_16 = 16,
|
||||||
NAL_UNIT_RESV_17 = 17,
|
NAL_UNIT_RESV_17 = 17,
|
||||||
NAL_UNIT_RESV_18 = 18,
|
NAL_UNIT_RESV_18 = 18,
|
||||||
NAL_UNIT_AUX_CODED_SLICE = 19,
|
NAL_UNIT_AUX_CODED_SLICE = 19,
|
||||||
NAL_UNIT_CODED_SLICE_EXT = 20,
|
NAL_UNIT_CODED_SLICE_EXT = 20,
|
||||||
NAL_UNIT_RESV_21 = 21,
|
NAL_UNIT_RESV_21 = 21,
|
||||||
NAL_UNIT_RESV_22 = 22,
|
NAL_UNIT_RESV_22 = 22,
|
||||||
NAL_UNIT_RESV_23 = 23,
|
NAL_UNIT_RESV_23 = 23,
|
||||||
NAL_UNIT_UNSPEC_24 = 24,
|
NAL_UNIT_UNSPEC_24 = 24,
|
||||||
NAL_UNIT_UNSPEC_25 = 25,
|
NAL_UNIT_UNSPEC_25 = 25,
|
||||||
NAL_UNIT_UNSPEC_26 = 26,
|
NAL_UNIT_UNSPEC_26 = 26,
|
||||||
NAL_UNIT_UNSPEC_27 = 27,
|
NAL_UNIT_UNSPEC_27 = 27,
|
||||||
NAL_UNIT_UNSPEC_28 = 28,
|
NAL_UNIT_UNSPEC_28 = 28,
|
||||||
NAL_UNIT_UNSPEC_29 = 29,
|
NAL_UNIT_UNSPEC_29 = 29,
|
||||||
NAL_UNIT_UNSPEC_30 = 30,
|
NAL_UNIT_UNSPEC_30 = 30,
|
||||||
NAL_UNIT_UNSPEC_31 = 31
|
NAL_UNIT_UNSPEC_31 = 31
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NAL Reference IDC (2 Bits)
|
* NAL Reference IDC (2 Bits)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum EWelsNalRefIdc {
|
enum EWelsNalRefIdc {
|
||||||
NRI_PRI_LOWEST = 0,
|
NRI_PRI_LOWEST = 0,
|
||||||
NRI_PRI_LOW = 1,
|
NRI_PRI_LOW = 1,
|
||||||
NRI_PRI_HIGH = 2,
|
NRI_PRI_HIGH = 2,
|
||||||
NRI_PRI_HIGHEST = 3
|
NRI_PRI_HIGHEST = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -131,25 +131,25 @@ enum EWelsNalRefIdc {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
enum EVclType {
|
enum EVclType {
|
||||||
NON_VCL = 0,
|
NON_VCL = 0,
|
||||||
VCL = 1,
|
VCL = 1,
|
||||||
NOT_APP = 2
|
NOT_APP = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* vcl type map for given NAL unit type and corresponding H264 type (0: AVC; 1: SVC).
|
* vcl type map for given NAL unit type and corresponding H264 type (0: AVC; 1: SVC).
|
||||||
*/
|
*/
|
||||||
extern const EVclType g_keTypeMap[32][2];
|
extern const EVclType g_keTypeMap[32][2];
|
||||||
|
|
||||||
#define IS_VCL_NAL(t, ext_idx) (g_keTypeMap[t][ext_idx] == VCL)
|
#define IS_VCL_NAL(t, ext_idx) (g_keTypeMap[t][ext_idx] == VCL)
|
||||||
#define IS_PARAM_SETS_NALS(t) ( (t) == NAL_UNIT_SPS || (t) == NAL_UNIT_PPS || (t) == NAL_UNIT_SUBSET_SPS )
|
#define IS_PARAM_SETS_NALS(t) ( (t) == NAL_UNIT_SPS || (t) == NAL_UNIT_PPS || (t) == NAL_UNIT_SUBSET_SPS )
|
||||||
#define IS_SPS_NAL(t) ( (t) == NAL_UNIT_SPS )
|
#define IS_SPS_NAL(t) ( (t) == NAL_UNIT_SPS )
|
||||||
#define IS_SUBSET_SPS_NAL(t) ( (t) == NAL_UNIT_SUBSET_SPS )
|
#define IS_SUBSET_SPS_NAL(t) ( (t) == NAL_UNIT_SUBSET_SPS )
|
||||||
#define IS_PPS_NAL(t) ( (t) == NAL_UNIT_PPS )
|
#define IS_PPS_NAL(t) ( (t) == NAL_UNIT_PPS )
|
||||||
#define IS_SEI_NAL(t) ( (t) == NAL_UNIT_SEI )
|
#define IS_SEI_NAL(t) ( (t) == NAL_UNIT_SEI )
|
||||||
#define IS_PREFIX_NAL(t) ( (t) == NAL_UNIT_PREFIX )
|
#define IS_PREFIX_NAL(t) ( (t) == NAL_UNIT_PREFIX )
|
||||||
#define IS_SUBSET_SPS_USED(t) ( (t) == NAL_UNIT_SUBSET_SPS || (t) == NAL_UNIT_CODED_SLICE_EXT )
|
#define IS_SUBSET_SPS_USED(t) ( (t) == NAL_UNIT_SUBSET_SPS || (t) == NAL_UNIT_CODED_SLICE_EXT )
|
||||||
#define IS_VCL_NAL_AVC_BASE(t) ( (t) == NAL_UNIT_CODED_SLICE || (t) == NAL_UNIT_CODED_SLICE_IDR )
|
#define IS_VCL_NAL_AVC_BASE(t) ( (t) == NAL_UNIT_CODED_SLICE || (t) == NAL_UNIT_CODED_SLICE_IDR )
|
||||||
#define IS_NEW_INTRODUCED_SVC_NAL(t) ( (t) == NAL_UNIT_PREFIX || (t) == NAL_UNIT_CODED_SLICE_EXT )
|
#define IS_NEW_INTRODUCED_SVC_NAL(t) ( (t) == NAL_UNIT_PREFIX || (t) == NAL_UNIT_CODED_SLICE_EXT )
|
||||||
|
|
||||||
|
|
||||||
@@ -160,9 +160,9 @@ extern const EVclType g_keTypeMap[32][2];
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
enum EWelsSliceType {
|
enum EWelsSliceType {
|
||||||
P_SLICE = 0,
|
P_SLICE = 0,
|
||||||
B_SLICE = 1,
|
B_SLICE = 1,
|
||||||
I_SLICE = 2,
|
I_SLICE = 2,
|
||||||
SP_SLICE = 3,
|
SP_SLICE = 3,
|
||||||
SI_SLICE = 4,
|
SI_SLICE = 4,
|
||||||
UNKNOWN_SLICE = 5
|
UNKNOWN_SLICE = 5
|
||||||
@@ -170,52 +170,52 @@ enum EWelsSliceType {
|
|||||||
|
|
||||||
/* SSlice Types in scalable extension */
|
/* SSlice Types in scalable extension */
|
||||||
enum ESliceTypeExt {
|
enum ESliceTypeExt {
|
||||||
EP_SLICE = 0, // EP_SLICE: 0, 5
|
EP_SLICE = 0, // EP_SLICE: 0, 5
|
||||||
EB_SLICE = 1, // EB_SLICE: 1, 6
|
EB_SLICE = 1, // EB_SLICE: 1, 6
|
||||||
EI_SLICE = 2 // EI_SLICE: 2, 7
|
EI_SLICE = 2 // EI_SLICE: 2, 7
|
||||||
};
|
};
|
||||||
|
|
||||||
/* List Index */
|
/* List Index */
|
||||||
enum EListIndex {
|
enum EListIndex {
|
||||||
LIST_0 = 0,
|
LIST_0 = 0,
|
||||||
LIST_1 = 1,
|
LIST_1 = 1,
|
||||||
LIST_A = 2
|
LIST_A = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Motion Vector components */
|
/* Motion Vector components */
|
||||||
enum EMvComp {
|
enum EMvComp {
|
||||||
MV_X = 0,
|
MV_X = 0,
|
||||||
MV_Y = 1,
|
MV_Y = 1,
|
||||||
MV_A = 2
|
MV_A = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Chroma Components */
|
/* Chroma Components */
|
||||||
|
|
||||||
enum EChromaComp {
|
enum EChromaComp {
|
||||||
CHROMA_CB = 0,
|
CHROMA_CB = 0,
|
||||||
CHROMA_CR = 1,
|
CHROMA_CR = 1,
|
||||||
CHROMA_A = 2
|
CHROMA_A = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Memory Management Control Operation (MMCO) code
|
* Memory Management Control Operation (MMCO) code
|
||||||
*/
|
*/
|
||||||
enum EMmcoCode {
|
enum EMmcoCode {
|
||||||
MMCO_END = 0,
|
MMCO_END = 0,
|
||||||
MMCO_SHORT2UNUSED = 1,
|
MMCO_SHORT2UNUSED = 1,
|
||||||
MMCO_LONG2UNUSED = 2,
|
MMCO_LONG2UNUSED = 2,
|
||||||
MMCO_SHORT2LONG = 3,
|
MMCO_SHORT2LONG = 3,
|
||||||
MMCO_SET_MAX_LONG = 4,
|
MMCO_SET_MAX_LONG = 4,
|
||||||
MMCO_RESET = 5,
|
MMCO_RESET = 5,
|
||||||
MMCO_LONG = 6
|
MMCO_LONG = 6
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bit-stream auxiliary reading / writing
|
* Bit-stream auxiliary reading / writing
|
||||||
*/
|
*/
|
||||||
typedef struct TagBitStringAux {
|
typedef struct TagBitStringAux {
|
||||||
uint8_t* pStartBuf; // buffer to start position
|
uint8_t* pStartBuf; // buffer to start position
|
||||||
|
|||||||
@@ -35,29 +35,29 @@
|
|||||||
|
|
||||||
// Miscellaneous sizing infos
|
// Miscellaneous sizing infos
|
||||||
#ifndef MAX_FNAME_LEN
|
#ifndef MAX_FNAME_LEN
|
||||||
#define MAX_FNAME_LEN 256 // maximal length of file name in char size
|
#define MAX_FNAME_LEN 256 // maximal length of file name in char size
|
||||||
#endif//MAX_FNAME_LEN
|
#endif//MAX_FNAME_LEN
|
||||||
|
|
||||||
#ifndef WELS_LOG_BUF_SIZE
|
#ifndef WELS_LOG_BUF_SIZE
|
||||||
#define WELS_LOG_BUF_SIZE 4096
|
#define WELS_LOG_BUF_SIZE 4096
|
||||||
#endif//WELS_LOG_BUF_SIZE
|
#endif//WELS_LOG_BUF_SIZE
|
||||||
|
|
||||||
#ifndef MAX_TRACE_LOG_SIZE
|
#ifndef MAX_TRACE_LOG_SIZE
|
||||||
#define MAX_TRACE_LOG_SIZE (50 * (1<<20)) // max trace log size: 50 MB, overwrite occur if log file size exceeds this size
|
#define MAX_TRACE_LOG_SIZE (50 * (1<<20)) // max trace log size: 50 MB, overwrite occur if log file size exceeds this size
|
||||||
#endif//MAX_TRACE_LOG_SIZE
|
#endif//MAX_TRACE_LOG_SIZE
|
||||||
|
|
||||||
/* MB width in pixels for specified colorspace I420 usually used in codec */
|
/* MB width in pixels for specified colorspace I420 usually used in codec */
|
||||||
#define MB_WIDTH_LUMA 16
|
#define MB_WIDTH_LUMA 16
|
||||||
#define MB_WIDTH_CHROMA (MB_WIDTH_LUMA>>1)
|
#define MB_WIDTH_CHROMA (MB_WIDTH_LUMA>>1)
|
||||||
/* MB height in pixels for specified colorspace I420 usually used in codec */
|
/* MB height in pixels for specified colorspace I420 usually used in codec */
|
||||||
#define MB_HEIGHT_LUMA 16
|
#define MB_HEIGHT_LUMA 16
|
||||||
#define MB_HEIGHT_CHROMA (MB_HEIGHT_LUMA>>1)
|
#define MB_HEIGHT_CHROMA (MB_HEIGHT_LUMA>>1)
|
||||||
#define MB_COEFF_LIST_SIZE (256+((MB_WIDTH_CHROMA*MB_HEIGHT_CHROMA)<<1))
|
#define MB_COEFF_LIST_SIZE (256+((MB_WIDTH_CHROMA*MB_HEIGHT_CHROMA)<<1))
|
||||||
#define MB_PARTITION_SIZE 4 // Macroblock partition size in 8x8 sub-blocks
|
#define MB_PARTITION_SIZE 4 // Macroblock partition size in 8x8 sub-blocks
|
||||||
#define MB_BLOCK4x4_NUM 16
|
#define MB_BLOCK4x4_NUM 16
|
||||||
#define MB_BLOCK8x8_NUM 4
|
#define MB_BLOCK8x8_NUM 4
|
||||||
#define MAX_SPS_COUNT 32 // Count number of SPS
|
#define MAX_SPS_COUNT 32 // Count number of SPS
|
||||||
#define BASE_QUALITY_ID 0
|
#define BASE_QUALITY_ID 0
|
||||||
|
|
||||||
|
|
||||||
#endif//WELS_CONST_COMMON_H__
|
#endif//WELS_CONST_COMMON_H__
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ const uint8_t g_kuiChromaQpTable[52] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* vcl type map for given NAL unit type and corresponding H264 type (0: AVC; 1: SVC).
|
* vcl type map for given NAL unit type and corresponding H264 type (0: AVC; 1: SVC).
|
||||||
*/
|
*/
|
||||||
const EVclType g_keTypeMap[32][2] = {
|
const EVclType g_keTypeMap[32][2] = {
|
||||||
{ NON_VCL, NON_VCL }, // 0: NAL_UNIT_UNSPEC_0
|
{ NON_VCL, NON_VCL }, // 0: NAL_UNIT_UNSPEC_0
|
||||||
|
|||||||
@@ -75,27 +75,27 @@ void WelsLog (SLogContext* logCtx, int32_t iLevel, const char* kpFmt, ...) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CALC_PSNR
|
#ifndef CALC_PSNR
|
||||||
#define CONST_FACTOR_PSNR (10.0 / log(10.0)) // for good computation
|
#define CONST_FACTOR_PSNR (10.0 / log(10.0)) // for good computation
|
||||||
#define CALC_PSNR(w, h, s) ((float)(CONST_FACTOR_PSNR * log( 65025.0 * w * h / iSqe )))
|
#define CALC_PSNR(w, h, s) ((float)(CONST_FACTOR_PSNR * log( 65025.0 * w * h / iSqe )))
|
||||||
#endif//CALC_PSNR
|
#endif//CALC_PSNR
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PSNR calculation routines
|
* PSNR calculation routines
|
||||||
*/
|
*/
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief PSNR calculation utilization in Wels
|
* \brief PSNR calculation utilization in Wels
|
||||||
*
|
*
|
||||||
* \param pTarPic target picture to be calculated in Picture pData format
|
* \param pTarPic target picture to be calculated in Picture pData format
|
||||||
* \param iTarStride stride of target picture pData pBuffer
|
* \param iTarStride stride of target picture pData pBuffer
|
||||||
* \param pRefPic base referencing picture samples
|
* \param pRefPic base referencing picture samples
|
||||||
* \param iRefStride stride of reference picture pData pBuffer
|
* \param iRefStride stride of reference picture pData pBuffer
|
||||||
* \param iWidth picture iWidth in pixel
|
* \param iWidth picture iWidth in pixel
|
||||||
* \param iHeight picture iHeight in pixel
|
* \param iHeight picture iHeight in pixel
|
||||||
*
|
*
|
||||||
* \return actual PSNR result;
|
* \return actual PSNR result;
|
||||||
*
|
*
|
||||||
* \note N/A
|
* \note N/A
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
float WelsCalcPsnr (const void* kpTarPic,
|
float WelsCalcPsnr (const void* kpTarPic,
|
||||||
|
|||||||
@@ -39,11 +39,11 @@ void Write2File (FILE* pFp, unsigned char* pData[3], int iStride[2], int iWidth,
|
|||||||
#ifdef ENABLE_DISPLAY_MODULE
|
#ifdef ENABLE_DISPLAY_MODULE
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
#define IDM_ABOUT 104
|
#define IDM_ABOUT 104
|
||||||
#define IDM_EXIT 105
|
#define IDM_EXIT 105
|
||||||
#define IDI_TESTSHARESURFACE 107
|
#define IDI_TESTSHARESURFACE 107
|
||||||
#define IDI_SMALL 108
|
#define IDI_SMALL 108
|
||||||
#define IDC_TESTSHARESURFACE 109
|
#define IDC_TESTSHARESURFACE 109
|
||||||
|
|
||||||
#define NV12_FORMAT MAKEFOURCC('N','V','1','2')
|
#define NV12_FORMAT MAKEFOURCC('N','V','1','2')
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ using namespace std;
|
|||||||
using namespace WelsEnc;
|
using namespace WelsEnc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Layer Context
|
* Layer Context
|
||||||
*/
|
*/
|
||||||
typedef struct LayerpEncCtx_s {
|
typedef struct LayerpEncCtx_s {
|
||||||
int32_t iDLayerQp;
|
int32_t iDLayerQp;
|
||||||
|
|||||||
@@ -50,37 +50,37 @@ namespace WelsDec {
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief Start Code Prefix (0x 00 00 00 01) detection
|
* \brief Start Code Prefix (0x 00 00 00 01) detection
|
||||||
*
|
*
|
||||||
* \param pBuf bitstream payload buffer
|
* \param pBuf bitstream payload buffer
|
||||||
* \param pOffset offset between NAL rbsp and original bitsteam that
|
* \param pOffset offset between NAL rbsp and original bitsteam that
|
||||||
* start code prefix is seperated from.
|
* start code prefix is seperated from.
|
||||||
* \param iBufSize count size of buffer
|
* \param iBufSize count size of buffer
|
||||||
*
|
*
|
||||||
* \return RBSP buffer of start code prefix exclusive
|
* \return RBSP buffer of start code prefix exclusive
|
||||||
*
|
*
|
||||||
* \note N/A
|
* \note N/A
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
uint8_t* DetectStartCodePrefix (const uint8_t* kpBuf, int32_t* pOffset, int32_t iBufSize);
|
uint8_t* DetectStartCodePrefix (const uint8_t* kpBuf, int32_t* pOffset, int32_t iBufSize);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief to parse network abstraction layer unit,
|
* \brief to parse network abstraction layer unit,
|
||||||
* escape emulation_prevention_three_byte within it
|
* escape emulation_prevention_three_byte within it
|
||||||
former name is parse_nal
|
former name is parse_nal
|
||||||
*
|
*
|
||||||
* \param pCtx decoder context
|
* \param pCtx decoder context
|
||||||
* \param pNalUnitHeader parsed result of NAL Unit Header to output
|
* \param pNalUnitHeader parsed result of NAL Unit Header to output
|
||||||
* \param pSrcRbsp bitstream buffer to input
|
* \param pSrcRbsp bitstream buffer to input
|
||||||
* \param iSrcRbspLen length size of bitstream buffer payload
|
* \param iSrcRbspLen length size of bitstream buffer payload
|
||||||
* \param pSrcNal
|
* \param pSrcNal
|
||||||
* \param iSrcNalLen
|
* \param iSrcNalLen
|
||||||
* \param pConsumedBytes consumed bytes during parsing
|
* \param pConsumedBytes consumed bytes during parsing
|
||||||
*
|
*
|
||||||
* \return decoded bytes payload, might be (pSrcRbsp+1) if no escapes
|
* \return decoded bytes payload, might be (pSrcRbsp+1) if no escapes
|
||||||
*
|
*
|
||||||
* \note N/A
|
* \note N/A
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeader, uint8_t* pSrcRbsp,
|
uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeader, uint8_t* pSrcRbsp,
|
||||||
@@ -100,33 +100,33 @@ bool CheckNextAuNewSeq (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief to parse Sequence Parameter Set (SPS)
|
* \brief to parse Sequence Parameter Set (SPS)
|
||||||
*
|
*
|
||||||
* \param pCtx Decoder context
|
* \param pCtx Decoder context
|
||||||
* \param pBsAux bitstream reader auxiliary
|
* \param pBsAux bitstream reader auxiliary
|
||||||
* \param pPicWidth picture width current Sps represented
|
* \param pPicWidth picture width current Sps represented
|
||||||
* \param pPicHeight picture height current Sps represented
|
* \param pPicHeight picture height current Sps represented
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* 1 - failed
|
* 1 - failed
|
||||||
*
|
*
|
||||||
* \note Call it in case eNalUnitType is SPS.
|
* \note Call it in case eNalUnitType is SPS.
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicWidth, int32_t* pPicHeight, uint8_t* pSrcNal, const int32_t kSrcNalLen);
|
int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicWidth, int32_t* pPicHeight, uint8_t* pSrcNal, const int32_t kSrcNalLen);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief to parse Picture Parameter Set (PPS)
|
* \brief to parse Picture Parameter Set (PPS)
|
||||||
*
|
*
|
||||||
* \param pCtx Decoder context
|
* \param pCtx Decoder context
|
||||||
* \param pPpsList pps list
|
* \param pPpsList pps list
|
||||||
* \param pBsAux bitstream reader auxiliary
|
* \param pBsAux bitstream reader auxiliary
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* 1 - failed
|
* 1 - failed
|
||||||
*
|
*
|
||||||
* \note Call it in case eNalUnitType is PPS.
|
* \note Call it in case eNalUnitType is PPS.
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux, uint8_t* pSrcNal, const int32_t kSrcNalLen);
|
int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux, uint8_t* pSrcNal, const int32_t kSrcNalLen);
|
||||||
@@ -148,26 +148,26 @@ int32_t SetScalingListValue (uint8_t *pScalingList,int iScalingListNum,bool* bUs
|
|||||||
int32_t ParseScalingList(PSps pSps,PBitStringAux pBs,bool bPPS,bool *bScalingListPresentFlag,uint8_t(*iScalingList4x4)[16],uint8_t(*iScalingList8x8)[64]);
|
int32_t ParseScalingList(PSps pSps,PBitStringAux pBs,bool bPPS,bool *bScalingListPresentFlag,uint8_t(*iScalingList4x4)[16],uint8_t(*iScalingList8x8)[64]);
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief to parse SEI message payload
|
* \brief to parse SEI message payload
|
||||||
*
|
*
|
||||||
* \param pSei sei message to be parsed output
|
* \param pSei sei message to be parsed output
|
||||||
* \param pBsAux bitstream reader auxiliary
|
* \param pBsAux bitstream reader auxiliary
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* 1 - failed
|
* 1 - failed
|
||||||
*
|
*
|
||||||
* \note Call it in case eNalUnitType is NAL_UNIT_SEI.
|
* \note Call it in case eNalUnitType is NAL_UNIT_SEI.
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t ParseSei (void* pSei, PBitStringAux pBsAux); // reserved Sei_Msg type
|
int32_t ParseSei (void* pSei, PBitStringAux pBsAux); // reserved Sei_Msg type
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief reset fmo list due to got Sps now
|
* \brief reset fmo list due to got Sps now
|
||||||
*
|
*
|
||||||
* \param pCtx decoder context
|
* \param pCtx decoder context
|
||||||
*
|
*
|
||||||
* \return count number of fmo context units are reset
|
* \return count number of fmo context units are reset
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t ResetFmoList (PWelsDecoderContext pCtx);
|
int32_t ResetFmoList (PWelsDecoderContext pCtx);
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ using namespace WelsCommon;
|
|||||||
namespace WelsDec {
|
namespace WelsDec {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief input bits for decoder or initialize bitstream writing in encoder
|
* \brief input bits for decoder or initialize bitstream writing in encoder
|
||||||
*
|
*
|
||||||
* \param pBitString Bit string auxiliary pointer
|
* \param pBitString Bit string auxiliary pointer
|
||||||
* \param kpBuf bit-stream buffer
|
* \param kpBuf bit-stream buffer
|
||||||
* \param kiSize size in bits for decoder; size in bytes for encoder
|
* \param kiSize size in bits for decoder; size in bytes for encoder
|
||||||
*
|
*
|
||||||
* \return size of buffer data in byte; failed in -1 return
|
* \return size of buffer data in byte; failed in -1 return
|
||||||
*/
|
*/
|
||||||
int32_t DecInitBits (PBitStringAux pBitString, const uint8_t* kpBuf, const int32_t kiSize);
|
int32_t DecInitBits (PBitStringAux pBitString, const uint8_t* kpBuf, const int32_t kiSize);
|
||||||
|
|
||||||
|
|||||||
@@ -46,35 +46,35 @@
|
|||||||
namespace WelsDec {
|
namespace WelsDec {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief deblocking module initialize
|
* \brief deblocking module initialize
|
||||||
*
|
*
|
||||||
* \param pf
|
* \param pf
|
||||||
* cpu
|
* cpu
|
||||||
*
|
*
|
||||||
* \return NONE
|
* \return NONE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void DeblockingInit (PDeblockingFunc pDeblockingFunc, int32_t iCpu);
|
void DeblockingInit (PDeblockingFunc pDeblockingFunc, int32_t iCpu);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief deblocking filtering target slice
|
* \brief deblocking filtering target slice
|
||||||
*
|
*
|
||||||
* \param dec Wels decoder context
|
* \param dec Wels decoder context
|
||||||
*
|
*
|
||||||
* \return NONE
|
* \return NONE
|
||||||
*/
|
*/
|
||||||
void WelsDeblockingFilterSlice (PWelsDecoderContext pCtx, PDeblockingFilterMbFunc pDeblockMb);
|
void WelsDeblockingFilterSlice (PWelsDecoderContext pCtx, PDeblockingFilterMbFunc pDeblockMb);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief pixel deblocking filtering
|
* \brief pixel deblocking filtering
|
||||||
*
|
*
|
||||||
* \param filter deblocking filter
|
* \param filter deblocking filter
|
||||||
* \param pix pixel value
|
* \param pix pixel value
|
||||||
* \param stride frame stride
|
* \param stride frame stride
|
||||||
* \param bs boundary strength
|
* \param bs boundary strength
|
||||||
*
|
*
|
||||||
* \return NONE
|
* \return NONE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint32_t DeblockingBsMarginalMBAvcbase (PDqLayer pCurDqLayer, int32_t iEdge, int32_t iNeighMb, int32_t iMbXy);
|
uint32_t DeblockingBsMarginalMBAvcbase (PDqLayer pCurDqLayer, int32_t iEdge, int32_t iNeighMb, int32_t iMbXy);
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ static inline int32_t BsGetBits (PBitStringAux pBs, int32_t iNumBits, uint32_t*
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exponential Golomb codes decoding routines
|
* Exponential Golomb codes decoding routines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// for data sharing cross modules and try to reduce size of binary generated, 12/10/2009
|
// for data sharing cross modules and try to reduce size of binary generated, 12/10/2009
|
||||||
@@ -122,7 +122,7 @@ static inline uint32_t GetPrefixBits (uint32_t uiValue) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read one bit from bit stream followed
|
* Read one bit from bit stream followed
|
||||||
*/
|
*/
|
||||||
static inline uint32_t BsGetOneBit (PBitStringAux pBs, uint32_t* pCode) {
|
static inline uint32_t BsGetOneBit (PBitStringAux pBs, uint32_t* pCode) {
|
||||||
return (BsGetBits (pBs, 1, pCode));
|
return (BsGetBits (pBs, 1, pCode));
|
||||||
@@ -185,7 +185,7 @@ static inline uint32_t BsGetUe (PBitStringAux pBs, uint32_t* pCode) {
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read signed exp golomb codes
|
* Read signed exp golomb codes
|
||||||
*/
|
*/
|
||||||
static inline int32_t BsGetSe (PBitStringAux pBs, int32_t* pCode) {
|
static inline int32_t BsGetSe (PBitStringAux pBs, int32_t* pCode) {
|
||||||
uint32_t uiCodeNum;
|
uint32_t uiCodeNum;
|
||||||
@@ -216,7 +216,7 @@ static inline int32_t BsGetTe0 (PBitStringAux pBs, int32_t iRange, uint32_t* pCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get number of trailing bits
|
* Get number of trailing bits
|
||||||
*/
|
*/
|
||||||
static inline int32_t BsGetTrailingBits (uint8_t* pBuf) {
|
static inline int32_t BsGetTrailingBits (uint8_t* pBuf) {
|
||||||
// TODO
|
// TODO
|
||||||
|
|||||||
@@ -50,53 +50,53 @@ extern "C" {
|
|||||||
#endif//__cplusplus
|
#endif//__cplusplus
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief configure decoder parameters
|
* \brief configure decoder parameters
|
||||||
*/
|
*/
|
||||||
int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpParam);
|
int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpParam);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief Initialize Wels decoder parameters and memory
|
* \brief Initialize Wels decoder parameters and memory
|
||||||
*
|
*
|
||||||
* \param pCtx input context to be initialized at first stage
|
* \param pCtx input context to be initialized at first stage
|
||||||
* \param pTraceHandle handle for trace
|
* \param pTraceHandle handle for trace
|
||||||
* \param pLo log info pointer
|
* \param pLo log info pointer
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* \return 1 - failed
|
* \return 1 - failed
|
||||||
*
|
*
|
||||||
* \note N/A
|
* \note N/A
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t WelsInitDecoder (PWelsDecoderContext pCtx, const bool bParseOnly, SLogContext* pLogCtx);
|
int32_t WelsInitDecoder (PWelsDecoderContext pCtx, const bool bParseOnly, SLogContext* pLogCtx);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief Uninitialize Wels decoder parameters and memory
|
* \brief Uninitialize Wels decoder parameters and memory
|
||||||
*
|
*
|
||||||
* \param pCtx input context to be uninitialized at release stage
|
* \param pCtx input context to be uninitialized at release stage
|
||||||
*
|
*
|
||||||
* \return NONE
|
* \return NONE
|
||||||
*
|
*
|
||||||
* \note N/A
|
* \note N/A
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
void WelsEndDecoder (PWelsDecoderContext pCtx);
|
void WelsEndDecoder (PWelsDecoderContext pCtx);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief First entrance to decoding core interface.
|
* \brief First entrance to decoding core interface.
|
||||||
*
|
*
|
||||||
* \param pCtx decoder context
|
* \param pCtx decoder context
|
||||||
* \param pBufBs bit streaming buffer
|
* \param pBufBs bit streaming buffer
|
||||||
* \param kBsLen size in bytes length of bit streaming buffer input
|
* \param kBsLen size in bytes length of bit streaming buffer input
|
||||||
* \param ppDst picture payload data to be output
|
* \param ppDst picture payload data to be output
|
||||||
* \param pDstBufInfo buf information of ouput data
|
* \param pDstBufInfo buf information of ouput data
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* \return 1 - failed
|
* \return 1 - failed
|
||||||
*
|
*
|
||||||
* \note N/A
|
* \note N/A
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -104,13 +104,13 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
|
|||||||
uint8_t** ppDst, SBufferInfo* pDstBufInfo, SParserBsInfo* pDstBsInfo);
|
uint8_t** ppDst, SBufferInfo* pDstBufInfo, SParserBsInfo* pDstBsInfo);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* request memory blocks for decoder avc part
|
* request memory blocks for decoder avc part
|
||||||
*/
|
*/
|
||||||
int32_t WelsRequestMem (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight);
|
int32_t WelsRequestMem (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* free memory blocks in avc
|
* free memory blocks in avc
|
||||||
*/
|
*/
|
||||||
void WelsFreeMem (PWelsDecoderContext pCtx);
|
void WelsFreeMem (PWelsDecoderContext pCtx);
|
||||||
|
|
||||||
@@ -120,13 +120,13 @@ void WelsFreeMem (PWelsDecoderContext pCtx);
|
|||||||
int32_t DecoderSetCsp (PWelsDecoderContext pCtx, const int32_t kiColorFormat);
|
int32_t DecoderSetCsp (PWelsDecoderContext pCtx, const int32_t kiColorFormat);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief make sure synchonozization picture resolution (get from slice header) among different parts (i.e, memory related and so on)
|
* \brief make sure synchonozization picture resolution (get from slice header) among different parts (i.e, memory related and so on)
|
||||||
* over decoder internal
|
* over decoder internal
|
||||||
* ( MB coordinate and parts of data within decoder context structure )
|
* ( MB coordinate and parts of data within decoder context structure )
|
||||||
* \param pCtx Wels decoder context
|
* \param pCtx Wels decoder context
|
||||||
* \param iMbWidth MB width
|
* \param iMbWidth MB width
|
||||||
* \pram iMbHeight MB height
|
* \pram iMbHeight MB height
|
||||||
* \return 0 - successful; none 0 - something wrong
|
* \return 0 - successful; none 0 - something wrong
|
||||||
*/
|
*/
|
||||||
int32_t SyncPictureResolutionExt (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight);
|
int32_t SyncPictureResolutionExt (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight);
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ typedef struct TagPpsBsInfo {
|
|||||||
//#endif//__cplusplus
|
//#endif//__cplusplus
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Need move below structures to function pointer to seperate module/file later
|
* Need move below structures to function pointer to seperate module/file later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//typedef int32_t (*rec_mb) (Mb *cur_mb, PWelsDecoderContext pCtx);
|
//typedef int32_t (*rec_mb) (Mb *cur_mb, PWelsDecoderContext pCtx);
|
||||||
@@ -226,7 +226,7 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SWelsDecoderContext: to maintail all modules data over decoder@framework
|
* SWelsDecoderContext: to maintail all modules data over decoder@framework
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct TagWelsDecoderContext {
|
typedef struct TagWelsDecoderContext {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace WelsDec {
|
|||||||
* InitBsBuffer
|
* InitBsBuffer
|
||||||
* Memory allocation for Bitstream Buffer
|
* Memory allocation for Bitstream Buffer
|
||||||
* return:
|
* return:
|
||||||
* 0 - success; otherwise returned error_no defined in error_no.h.
|
* 0 - success; otherwise returned error_no defined in error_no.h.
|
||||||
*/
|
*/
|
||||||
int32_t InitBsBuffer (PWelsDecoderContext pCtx);
|
int32_t InitBsBuffer (PWelsDecoderContext pCtx);
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ int32_t InitBsBuffer (PWelsDecoderContext pCtx);
|
|||||||
* Expand current BS buffer and copy its content
|
* Expand current BS buffer and copy its content
|
||||||
* new buffer size will consider input size as a reference
|
* new buffer size will consider input size as a reference
|
||||||
* return:
|
* return:
|
||||||
* 0 - success; otherwise returned error_no defined in error_no.h.
|
* 0 - success; otherwise returned error_no defined in error_no.h.
|
||||||
*/
|
*/
|
||||||
int32_t ExpandBsBuffer (PWelsDecoderContext pCtx, const int32_t kiSrcLen);
|
int32_t ExpandBsBuffer (PWelsDecoderContext pCtx, const int32_t kiSrcLen);
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ int32_t CheckBsBuffer (PWelsDecoderContext pCtx, const int32_t kiSrcLen);
|
|||||||
* Especially for:
|
* Especially for:
|
||||||
* rbsp_au_buffer, cur_dq_layer_ptr and ref_dq_layer_ptr in MB info cache.
|
* rbsp_au_buffer, cur_dq_layer_ptr and ref_dq_layer_ptr in MB info cache.
|
||||||
* return:
|
* return:
|
||||||
* 0 - success; otherwise returned error_no defined in error_no.h.
|
* 0 - success; otherwise returned error_no defined in error_no.h.
|
||||||
*/
|
*/
|
||||||
int32_t WelsInitMemory (PWelsDecoderContext pCtx);
|
int32_t WelsInitMemory (PWelsDecoderContext pCtx);
|
||||||
|
|
||||||
@@ -89,33 +89,33 @@ int32_t WelsInitMemory (PWelsDecoderContext pCtx);
|
|||||||
void WelsFreeMemory (PWelsDecoderContext pCtx);
|
void WelsFreeMemory (PWelsDecoderContext pCtx);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief request memory when maximal picture width and height are available
|
* \brief request memory when maximal picture width and height are available
|
||||||
*/
|
*/
|
||||||
int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWidth, const int32_t kiMaxHeight);
|
int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWidth, const int32_t kiMaxHeight);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief free dq layer context memory related
|
* \brief free dq layer context memory related
|
||||||
*/
|
*/
|
||||||
void UninitialDqLayersContext (PWelsDecoderContext pCtx);
|
void UninitialDqLayersContext (PWelsDecoderContext pCtx);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DecodeNalHeaderExt
|
* DecodeNalHeaderExt
|
||||||
* Trigger condition: NAL_UNIT_TYPE = NAL_UNIT_PREFIX or NAL_UNIT_CODED_SLICE_EXT
|
* Trigger condition: NAL_UNIT_TYPE = NAL_UNIT_PREFIX or NAL_UNIT_CODED_SLICE_EXT
|
||||||
* Parameter:
|
* Parameter:
|
||||||
* pNal: target NALUnit ptr
|
* pNal: target NALUnit ptr
|
||||||
* pSrc: NAL Unit bitstream
|
* pSrc: NAL Unit bitstream
|
||||||
*/
|
*/
|
||||||
void DecodeNalHeaderExt (PNalUnit pNal, uint8_t* pSrc);
|
void DecodeNalHeaderExt (PNalUnit pNal, uint8_t* pSrc);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ParseSliceHeaderSyntaxs
|
* ParseSliceHeaderSyntaxs
|
||||||
* Parse slice header of bitstream
|
* Parse slice header of bitstream
|
||||||
*/
|
*/
|
||||||
int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, const bool kbExtensionFlag);
|
int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, const bool kbExtensionFlag);
|
||||||
/*
|
/*
|
||||||
* Copy relative syntax elements of NALUnitHeaderExt, sRefPicBaseMarking and bStoreRefBasePicFlag in prefix nal unit.
|
* Copy relative syntax elements of NALUnitHeaderExt, sRefPicBaseMarking and bStoreRefBasePicFlag in prefix nal unit.
|
||||||
* pSrc: mark as decoded prefix NAL
|
* pSrc: mark as decoded prefix NAL
|
||||||
* pDst: succeeded VCL NAL based AVC (I/P Slice)
|
* pDst: succeeded VCL NAL based AVC (I/P Slice)
|
||||||
*/
|
*/
|
||||||
bool PrefetchNalHeaderExtSyntax (PWelsDecoderContext pCtx, PNalUnit const kpDst, PNalUnit const kpSrc);
|
bool PrefetchNalHeaderExtSyntax (PWelsDecoderContext pCtx, PNalUnit const kpDst, PNalUnit const kpSrc);
|
||||||
|
|
||||||
@@ -125,12 +125,12 @@ bool PrefetchNalHeaderExtSyntax (PWelsDecoderContext pCtx, PNalUnit const kpDst,
|
|||||||
* construct an access unit for given input bitstream, maybe partial NAL Unit, one or more Units are involved to
|
* construct an access unit for given input bitstream, maybe partial NAL Unit, one or more Units are involved to
|
||||||
* joint a collective access unit.
|
* joint a collective access unit.
|
||||||
* parameter\
|
* parameter\
|
||||||
* buf: bitstream data buffer
|
* buf: bitstream data buffer
|
||||||
* bit_len: size in bit length of data
|
* bit_len: size in bit length of data
|
||||||
* buf_len: size in byte length of data
|
* buf_len: size in byte length of data
|
||||||
* coded_au: mark an Access Unit decoding finished
|
* coded_au: mark an Access Unit decoding finished
|
||||||
* return:
|
* return:
|
||||||
* 0 - success; otherwise returned error_no defined in error_no.h
|
* 0 - success; otherwise returned error_no defined in error_no.h
|
||||||
*/
|
*/
|
||||||
int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo);
|
int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo);
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
|
|||||||
*/
|
*/
|
||||||
bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** pDst, SBufferInfo* pDstInfo);
|
bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** pDst, SBufferInfo* pDstInfo);
|
||||||
/*
|
/*
|
||||||
* Prepare current dq layer context initialization.
|
* Prepare current dq layer context initialization.
|
||||||
*/
|
*/
|
||||||
void WelsDqLayerDecodeStart (PWelsDecoderContext pCtx, PNalUnit pCurNal, PSps pSps, PPps pPps);
|
void WelsDqLayerDecodeStart (PWelsDecoderContext pCtx, PNalUnit pCurNal, PSps pSps, PPps pPps);
|
||||||
|
|
||||||
|
|||||||
@@ -43,12 +43,12 @@
|
|||||||
namespace WelsDec {
|
namespace WelsDec {
|
||||||
|
|
||||||
typedef enum TagWelsErr {
|
typedef enum TagWelsErr {
|
||||||
ERR_NONE = 0,
|
ERR_NONE = 0,
|
||||||
ERR_INVALID_PARAMETERS = 1,
|
ERR_INVALID_PARAMETERS = 1,
|
||||||
ERR_MALLOC_FAILED = 2,
|
ERR_MALLOC_FAILED = 2,
|
||||||
ERR_API_FAILED = 3,
|
ERR_API_FAILED = 3,
|
||||||
|
|
||||||
ERR_BOUND = 31
|
ERR_BOUND = 31
|
||||||
} EWelsErr;
|
} EWelsErr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -75,12 +75,12 @@ ERR_LEVEL_MB_DATA
|
|||||||
|
|
||||||
/* More detailed error information, maximal value is 65535 */
|
/* More detailed error information, maximal value is 65535 */
|
||||||
//-----------------------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------------------
|
||||||
#define ERR_INFO_COMMON_BASE 1
|
#define ERR_INFO_COMMON_BASE 1
|
||||||
#define ERR_INFO_SYNTAX_BASE 1001
|
#define ERR_INFO_SYNTAX_BASE 1001
|
||||||
#define ERR_INFO_LOGIC_BASE 10001
|
#define ERR_INFO_LOGIC_BASE 10001
|
||||||
enum {
|
enum {
|
||||||
/* Error from common system level: 1-1000 */
|
/* Error from common system level: 1-1000 */
|
||||||
ERR_INFO_OUT_OF_MEMORY = ERR_INFO_COMMON_BASE,
|
ERR_INFO_OUT_OF_MEMORY = ERR_INFO_COMMON_BASE,
|
||||||
ERR_INFO_INVALID_ACCESS,
|
ERR_INFO_INVALID_ACCESS,
|
||||||
ERR_INFO_INVALID_PTR,
|
ERR_INFO_INVALID_PTR,
|
||||||
ERR_INFO_INVALID_PARAM,
|
ERR_INFO_INVALID_PARAM,
|
||||||
@@ -93,9 +93,9 @@ ERR_INFO_READ_FAULT,
|
|||||||
ERR_INFO_READ_OVERFLOW,
|
ERR_INFO_READ_OVERFLOW,
|
||||||
ERR_INFO_READ_LEADING_ZERO,
|
ERR_INFO_READ_LEADING_ZERO,
|
||||||
/* Error from H.264 syntax elements parser: 1001-10000 */
|
/* Error from H.264 syntax elements parser: 1001-10000 */
|
||||||
ERR_INFO_NO_PREFIX_CODE = ERR_INFO_SYNTAX_BASE, // No start prefix code indication
|
ERR_INFO_NO_PREFIX_CODE = ERR_INFO_SYNTAX_BASE, // No start prefix code indication
|
||||||
ERR_INFO_NO_PARAM_SETS, // No SPS and/ PPS before sequence header
|
ERR_INFO_NO_PARAM_SETS, // No SPS and/ PPS before sequence header
|
||||||
ERR_INFO_PARAM_SETS_NOT_INTEGRATED, // Parameters sets (sps/pps) are not integrated at all before to decode VCL nal
|
ERR_INFO_PARAM_SETS_NOT_INTEGRATED, // Parameters sets (sps/pps) are not integrated at all before to decode VCL nal
|
||||||
ERR_INFO_SPS_ID_OVERFLOW,
|
ERR_INFO_SPS_ID_OVERFLOW,
|
||||||
ERR_INFO_PPS_ID_OVERFLOW,
|
ERR_INFO_PPS_ID_OVERFLOW,
|
||||||
ERR_INFO_INVALID_PROFILE_IDC,
|
ERR_INFO_INVALID_PROFILE_IDC,
|
||||||
@@ -179,7 +179,7 @@ ERR_INFO_INVALID_REF_MARKING,
|
|||||||
ERR_INFO_INVALID_REF_REORDERING,
|
ERR_INFO_INVALID_REF_REORDERING,
|
||||||
|
|
||||||
/* Error from corresponding logic, 10001-65535 */
|
/* Error from corresponding logic, 10001-65535 */
|
||||||
ERR_INFO_NO_IDR_PIC = ERR_INFO_LOGIC_BASE, // NO IDR picture available before sequence header
|
ERR_INFO_NO_IDR_PIC = ERR_INFO_LOGIC_BASE, // NO IDR picture available before sequence header
|
||||||
ERR_INFO_EC_NO_NEIGHBOUR_MBS,
|
ERR_INFO_EC_NO_NEIGHBOUR_MBS,
|
||||||
ERR_INFO_EC_UNEXPECTED_MB_TYPE,
|
ERR_INFO_EC_UNEXPECTED_MB_TYPE,
|
||||||
ERR_INFO_EC_NO_ENOUGH_NEIGHBOUR_MBS,
|
ERR_INFO_EC_NO_ENOUGH_NEIGHBOUR_MBS,
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace WelsDec {
|
|||||||
#endif//MB_XY_T
|
#endif//MB_XY_T
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Wels Flexible Macroblock Ordering (FMO)
|
* \brief Wels Flexible Macroblock Ordering (FMO)
|
||||||
*/
|
*/
|
||||||
typedef struct TagFmo {
|
typedef struct TagFmo {
|
||||||
uint8_t* pMbAllocMap;
|
uint8_t* pMbAllocMap;
|
||||||
@@ -64,47 +64,47 @@ uint8_t uiReserved[3]; // reserved padding bytes
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Initialize Wels Flexible Macroblock Ordering (FMO)
|
* \brief Initialize Wels Flexible Macroblock Ordering (FMO)
|
||||||
*
|
*
|
||||||
* \param pFmo Wels fmo to be initialized
|
* \param pFmo Wels fmo to be initialized
|
||||||
* \param pPps PPps
|
* \param pPps PPps
|
||||||
* \param kiMbWidth mb width
|
* \param kiMbWidth mb width
|
||||||
* \param kiMbHeight mb height
|
* \param kiMbHeight mb height
|
||||||
*
|
*
|
||||||
* \return 0 - successful; none 0 - failed;
|
* \return 0 - successful; none 0 - failed;
|
||||||
*/
|
*/
|
||||||
int32_t InitFmo (PFmo pFmo, PPps pPps, const int32_t kiMbWidth, const int32_t kiMbHeight);
|
int32_t InitFmo (PFmo pFmo, PPps pPps, const int32_t kiMbWidth, const int32_t kiMbHeight);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Uninitialize Wels Flexible Macroblock Ordering (FMO) list
|
* \brief Uninitialize Wels Flexible Macroblock Ordering (FMO) list
|
||||||
*
|
*
|
||||||
* \param pFmo Wels base fmo ptr to be uninitialized
|
* \param pFmo Wels base fmo ptr to be uninitialized
|
||||||
* \param kiCnt count number of PPS per list
|
* \param kiCnt count number of PPS per list
|
||||||
* \param kiAvail count available number of PPS in list
|
* \param kiAvail count available number of PPS in list
|
||||||
*
|
*
|
||||||
* \return NONE
|
* \return NONE
|
||||||
*/
|
*/
|
||||||
void UninitFmoList (PFmo pFmo, const int32_t kiCnt, const int32_t kiAvail);
|
void UninitFmoList (PFmo pFmo, const int32_t kiCnt, const int32_t kiAvail);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief update/insert FMO parameter unit
|
* \brief update/insert FMO parameter unit
|
||||||
*
|
*
|
||||||
* \param pFmo FMO context
|
* \param pFmo FMO context
|
||||||
* \param pSps PSps
|
* \param pSps PSps
|
||||||
* \param pPps PPps
|
* \param pPps PPps
|
||||||
* \param pActiveFmoNum int32_t* [in/out]
|
* \param pActiveFmoNum int32_t* [in/out]
|
||||||
*
|
*
|
||||||
* \return true - update/insert successfully; false - failed;
|
* \return true - update/insert successfully; false - failed;
|
||||||
*/
|
*/
|
||||||
bool FmoParamUpdate (PFmo pFmo, PSps pSps, PPps pPps, int32_t* pActiveFmoNum);
|
bool FmoParamUpdate (PFmo pFmo, PSps pSps, PPps pPps, int32_t* pActiveFmoNum);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get successive mb to be processed with given current mb_xy
|
* \brief Get successive mb to be processed with given current mb_xy
|
||||||
*
|
*
|
||||||
* \param pFmo Wels fmo context
|
* \param pFmo Wels fmo context
|
||||||
* \param iMbXy current mb_xy
|
* \param iMbXy current mb_xy
|
||||||
*
|
*
|
||||||
* \return iNextMb - successful; -1 - failed;
|
* \return iNextMb - successful; -1 - failed;
|
||||||
*/
|
*/
|
||||||
MB_XY_T FmoNextMb (PFmo pFmo, const MB_XY_T kiMbXy);
|
MB_XY_T FmoNextMb (PFmo pFmo, const MB_XY_T kiMbXy);
|
||||||
|
|
||||||
|
|||||||
@@ -42,15 +42,15 @@ namespace WelsDec {
|
|||||||
#define REF_NOT_IN_LIST -1 //intra
|
#define REF_NOT_IN_LIST -1 //intra
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MB Cache information, such one cache should be defined within a slice
|
* MB Cache information, such one cache should be defined within a slice
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Cache for Luma Cache for Chroma(Cb, Cr)
|
* Cache for Luma Cache for Chroma(Cb, Cr)
|
||||||
*
|
*
|
||||||
* TL T T T T TL T T
|
* TL T T T T TL T T
|
||||||
* L - - - - L - -
|
* L - - - - L - -
|
||||||
* L - - - - L - - TR
|
* L - - - - L - - TR
|
||||||
* L - - - -
|
* L - - - -
|
||||||
* L - - - - TR
|
* L - - - - TR
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ int32_t MemInitNalList (PAccessUnit* ppAu, const uint32_t kuiSize);
|
|||||||
int32_t MemFreeNalList (PAccessUnit* ppAu);
|
int32_t MemFreeNalList (PAccessUnit* ppAu);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MemGetNextNal
|
* MemGetNextNal
|
||||||
* Get next NAL Unit for using.
|
* Get next NAL Unit for using.
|
||||||
* Need expand NAL Unit list if exceeding count number of available NAL Units withing an Access Unit
|
* Need expand NAL Unit list if exceeding count number of available NAL Units withing an Access Unit
|
||||||
*/
|
*/
|
||||||
PNalUnit MemGetNextNal (PAccessUnit* ppAu);
|
PNalUnit MemGetNextNal (PAccessUnit* ppAu);
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
namespace WelsDec {
|
namespace WelsDec {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief update mv and ref_index cache for current MB, only for P_16x16 (SKIP inclusive)
|
* \brief update mv and ref_index cache for current MB, only for P_16x16 (SKIP inclusive)
|
||||||
* \param
|
* \param
|
||||||
* \param
|
* \param
|
||||||
*/
|
*/
|
||||||
@@ -63,7 +63,7 @@ void UpdateP16x8MotionInfo (PDqLayer pCurDqLayer, int16_t iMotionVector[LIST_A][
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief update mv and ref_index cache for current MB, only for P_8x16
|
* \brief update mv and ref_index cache for current MB, only for P_8x16
|
||||||
* \param
|
* \param
|
||||||
* \param
|
* \param
|
||||||
*/
|
*/
|
||||||
@@ -74,14 +74,14 @@ void UpdateP8x16MotionInfo (PDqLayer pCurDqLayer, int16_t iMotionVector[LIST_A][
|
|||||||
/*!
|
/*!
|
||||||
* \brief get the motion predictor for skip mode
|
* \brief get the motion predictor for skip mode
|
||||||
* \param
|
* \param
|
||||||
* \param output iMvp[]
|
* \param output iMvp[]
|
||||||
*/
|
*/
|
||||||
void PredPSkipMvFromNeighbor (PDqLayer pCurLayer, int16_t iMvp[2]);
|
void PredPSkipMvFromNeighbor (PDqLayer pCurLayer, int16_t iMvp[2]);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief get the motion predictor for 4*4 or 8*8 or 16*16 block
|
* \brief get the motion predictor for 4*4 or 8*8 or 16*16 block
|
||||||
* \param
|
* \param
|
||||||
* \param output iMvp[]
|
* \param output iMvp[]
|
||||||
*/
|
*/
|
||||||
void PredMv (int16_t iMotionVector[LIST_A][30][MV_A], int8_t iRefIndex[LIST_A][30],
|
void PredMv (int16_t iMotionVector[LIST_A][30][MV_A], int8_t iRefIndex[LIST_A][30],
|
||||||
int32_t iPartIdx, int32_t iPartWidth, int8_t iRef, int16_t iMVP[2]);
|
int32_t iPartIdx, int32_t iPartWidth, int8_t iRef, int16_t iMVP[2]);
|
||||||
@@ -89,7 +89,7 @@ void PredMv (int16_t iMotionVector[LIST_A][30][MV_A], int8_t iRefIndex[LIST_A][3
|
|||||||
/*!
|
/*!
|
||||||
* \brief get the motion predictor for inter16x8 MB
|
* \brief get the motion predictor for inter16x8 MB
|
||||||
* \param
|
* \param
|
||||||
* \param output mvp_x and mvp_y
|
* \param output mvp_x and mvp_y
|
||||||
*/
|
*/
|
||||||
void PredInter16x8Mv (int16_t iMotionVector[LIST_A][30][MV_A], int8_t iRefIndex[LIST_A][30],
|
void PredInter16x8Mv (int16_t iMotionVector[LIST_A][30][MV_A], int8_t iRefIndex[LIST_A][30],
|
||||||
int32_t iPartIdx, int8_t iRef, int16_t iMVP[2]);
|
int32_t iPartIdx, int8_t iRef, int16_t iMVP[2]);
|
||||||
@@ -97,7 +97,7 @@ void PredInter16x8Mv (int16_t iMotionVector[LIST_A][30][MV_A], int8_t iRefIndex[
|
|||||||
/*!
|
/*!
|
||||||
* \brief get the motion predictor for inter8x16 MB
|
* \brief get the motion predictor for inter8x16 MB
|
||||||
* \param
|
* \param
|
||||||
* \param output mvp_x and mvp_y
|
* \param output mvp_x and mvp_y
|
||||||
*/
|
*/
|
||||||
void PredInter8x16Mv (int16_t iMotionVector[LIST_A][30][MV_A], int8_t iRefIndex[LIST_A][30],
|
void PredInter8x16Mv (int16_t iMotionVector[LIST_A][30][MV_A], int8_t iRefIndex[LIST_A][30],
|
||||||
int32_t iPartIdx, int8_t iRef, int16_t iMVP[2]);
|
int32_t iPartIdx, int8_t iRef, int16_t iMVP[2]);
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ int32_t iCurrentIdx;
|
|||||||
} SPicBuff, *PPicBuff;
|
} SPicBuff, *PPicBuff;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Interfaces
|
* Interfaces
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PPicture PrefetchPic (PPicBuff pPicBuff); // To get current node applicable
|
PPicture PrefetchPic (PPicBuff pPicBuff); // To get current node applicable
|
||||||
|
|||||||
@@ -39,8 +39,8 @@
|
|||||||
namespace WelsDec {
|
namespace WelsDec {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reconstructed Picture definition
|
* Reconstructed Picture definition
|
||||||
* It is used to express reference picture, also consequent reconstruction picture for output
|
* It is used to express reference picture, also consequent reconstruction picture for output
|
||||||
*/
|
*/
|
||||||
typedef struct TagPicture {
|
typedef struct TagPicture {
|
||||||
/************************************payload data*********************************/
|
/************************************payload data*********************************/
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
namespace WelsDec {
|
namespace WelsDec {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reference picture list reordering syntax, refer to page 64 in JVT X201wcm
|
* Reference picture list reordering syntax, refer to page 64 in JVT X201wcm
|
||||||
*/
|
*/
|
||||||
typedef struct TagRefPicListReorderSyntax {
|
typedef struct TagRefPicListReorderSyntax {
|
||||||
struct {
|
struct {
|
||||||
@@ -55,7 +55,7 @@ bool bRefPicListReorderingFlag[LIST_A];
|
|||||||
} SRefPicListReorderSyn, *PRefPicListReorderSyn;
|
} SRefPicListReorderSyn, *PRefPicListReorderSyn;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prediction weight table syntax, refer to page 65 in JVT X201wcm
|
* Prediction weight table syntax, refer to page 65 in JVT X201wcm
|
||||||
*/
|
*/
|
||||||
typedef struct TagPredWeightTabSyntax {
|
typedef struct TagPredWeightTabSyntax {
|
||||||
uint32_t uiLumaLog2WeightDenom;
|
uint32_t uiLumaLog2WeightDenom;
|
||||||
|
|||||||
@@ -38,25 +38,25 @@
|
|||||||
|
|
||||||
/* Some list size */
|
/* Some list size */
|
||||||
|
|
||||||
#define MB_SUB_PARTITION_SIZE 4 // Sub partition size in a 8x8 sub-block
|
#define MB_SUB_PARTITION_SIZE 4 // Sub partition size in a 8x8 sub-block
|
||||||
#define NAL_UNIT_HEADER_EXT_SIZE 3 // Size of NAL unit header for extension in byte
|
#define NAL_UNIT_HEADER_EXT_SIZE 3 // Size of NAL unit header for extension in byte
|
||||||
#define MAX_PPS_COUNT 256 // Count number of PPS
|
#define MAX_PPS_COUNT 256 // Count number of PPS
|
||||||
|
|
||||||
#define MAX_REF_PIC_COUNT 16 // MAX Short + Long reference pictures
|
#define MAX_REF_PIC_COUNT 16 // MAX Short + Long reference pictures
|
||||||
#define MIN_REF_PIC_COUNT 1 // minimal count number of reference pictures, 1 short + 2 key reference based?
|
#define MIN_REF_PIC_COUNT 1 // minimal count number of reference pictures, 1 short + 2 key reference based?
|
||||||
#define MAX_SHORT_REF_COUNT 16 // maximal count number of short reference pictures
|
#define MAX_SHORT_REF_COUNT 16 // maximal count number of short reference pictures
|
||||||
#define MAX_LONG_REF_COUNT 16 // maximal count number of long reference pictures
|
#define MAX_LONG_REF_COUNT 16 // maximal count number of long reference pictures
|
||||||
|
|
||||||
#define MAX_MMCO_COUNT 66
|
#define MAX_MMCO_COUNT 66
|
||||||
|
|
||||||
#define MAX_SLICEGROUP_IDS 8 // Count number of Slice Groups
|
#define MAX_SLICEGROUP_IDS 8 // Count number of Slice Groups
|
||||||
|
|
||||||
#define MAX_LAYER_NUM 8
|
#define MAX_LAYER_NUM 8
|
||||||
|
|
||||||
#define LAYER_NUM_EXCHANGEABLE 1
|
#define LAYER_NUM_EXCHANGEABLE 1
|
||||||
|
|
||||||
#define MAX_NAL_UNIT_NUM_IN_AU 32 // predefined maximal number of NAL Units in an access unit
|
#define MAX_NAL_UNIT_NUM_IN_AU 32 // predefined maximal number of NAL Units in an access unit
|
||||||
#define MIN_ACCESS_UNIT_CAPACITY 1048576 // Min AU capacity in bytes: (1<<20) = 1024 KB predefined
|
#define MIN_ACCESS_UNIT_CAPACITY 1048576 // Min AU capacity in bytes: (1<<20) = 1024 KB predefined
|
||||||
#define MAX_BUFFERED_NUM 3 //mamixum stored number of AU|packet to prevent overwrite
|
#define MAX_BUFFERED_NUM 3 //mamixum stored number of AU|packet to prevent overwrite
|
||||||
#define MAX_ACCESS_UNIT_CAPACITY 7077888 //Maximum AU size in bytes for level 5.2 for single frame
|
#define MAX_ACCESS_UNIT_CAPACITY 7077888 //Maximum AU size in bytes for level 5.2 for single frame
|
||||||
#define MAX_MACROBLOCK_CAPACITY 5000 //Maximal legal MB capacity, 15000 bits is enough
|
#define MAX_MACROBLOCK_CAPACITY 5000 //Maximal legal MB capacity, 15000 bits is enough
|
||||||
|
|||||||
@@ -49,16 +49,16 @@
|
|||||||
namespace WelsDec {
|
namespace WelsDec {
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief Start Code Prefix (0x 00 00 00 01) detection
|
* \brief Start Code Prefix (0x 00 00 00 01) detection
|
||||||
*
|
*
|
||||||
* \param pBuf bitstream payload buffer
|
* \param pBuf bitstream payload buffer
|
||||||
* \param pOffset offset between NAL rbsp and original bitsteam that
|
* \param pOffset offset between NAL rbsp and original bitsteam that
|
||||||
* start code prefix is seperated from.
|
* start code prefix is seperated from.
|
||||||
* \param iBufSize count size of buffer
|
* \param iBufSize count size of buffer
|
||||||
*
|
*
|
||||||
* \return RBSP buffer of start code prefix exclusive
|
* \return RBSP buffer of start code prefix exclusive
|
||||||
*
|
*
|
||||||
* \note N/A
|
* \note N/A
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
uint8_t* DetectStartCodePrefix (const uint8_t* kpBuf, int32_t* pOffset, int32_t iBufSize) {
|
uint8_t* DetectStartCodePrefix (const uint8_t* kpBuf, int32_t* pOffset, int32_t iBufSize) {
|
||||||
@@ -88,19 +88,19 @@ uint8_t* DetectStartCodePrefix (const uint8_t* kpBuf, int32_t* pOffset, int32_t
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief to parse nal unit
|
* \brief to parse nal unit
|
||||||
*
|
*
|
||||||
* \param pCtx decoder context
|
* \param pCtx decoder context
|
||||||
* \param pNalUnitHeader parsed result of NAL Unit Header to output
|
* \param pNalUnitHeader parsed result of NAL Unit Header to output
|
||||||
* \param pSrcRbsp bitstream buffer to input
|
* \param pSrcRbsp bitstream buffer to input
|
||||||
* \param iSrcRbspLen length size of bitstream buffer payload
|
* \param iSrcRbspLen length size of bitstream buffer payload
|
||||||
* \param pSrcNal
|
* \param pSrcNal
|
||||||
* \param iSrcNalLen
|
* \param iSrcNalLen
|
||||||
* \param pConsumedBytes consumed bytes during parsing
|
* \param pConsumedBytes consumed bytes during parsing
|
||||||
*
|
*
|
||||||
* \return decoded bytes payload, might be (pSrcRbsp+1) if no escapes
|
* \return decoded bytes payload, might be (pSrcRbsp+1) if no escapes
|
||||||
*
|
*
|
||||||
* \note N/A
|
* \note N/A
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeader, uint8_t* pSrcRbsp,
|
uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeader, uint8_t* pSrcRbsp,
|
||||||
@@ -563,14 +563,14 @@ bool CheckNextAuNewSeq (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief to parse NON VCL NAL Units
|
* \brief to parse NON VCL NAL Units
|
||||||
*
|
*
|
||||||
* \param pCtx decoder context
|
* \param pCtx decoder context
|
||||||
* \param rbsp rbsp buffer of NAL Unit
|
* \param rbsp rbsp buffer of NAL Unit
|
||||||
* \param src_len length of rbsp buffer
|
* \param src_len length of rbsp buffer
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* 1 - failed
|
* 1 - failed
|
||||||
*
|
*
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -887,17 +887,17 @@ bool CheckSpsActive (PWelsDecoderContext pCtx, PSps pSps, bool bUseSubsetFlag) {
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief to parse Sequence Parameter Set (SPS)
|
* \brief to parse Sequence Parameter Set (SPS)
|
||||||
*
|
*
|
||||||
* \param pCtx Decoder context
|
* \param pCtx Decoder context
|
||||||
* \param pBsAux bitstream reader auxiliary
|
* \param pBsAux bitstream reader auxiliary
|
||||||
* \param pPicWidth picture width current Sps represented
|
* \param pPicWidth picture width current Sps represented
|
||||||
* \param pPicHeight picture height current Sps represented
|
* \param pPicHeight picture height current Sps represented
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* 1 - failed
|
* 1 - failed
|
||||||
*
|
*
|
||||||
* \note Call it in case eNalUnitType is SPS.
|
* \note Call it in case eNalUnitType is SPS.
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -1263,16 +1263,16 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief to parse Picture Parameter Set (PPS)
|
* \brief to parse Picture Parameter Set (PPS)
|
||||||
*
|
*
|
||||||
* \param pCtx Decoder context
|
* \param pCtx Decoder context
|
||||||
* \param pPpsList pps list
|
* \param pPpsList pps list
|
||||||
* \param pBsAux bitstream reader auxiliary
|
* \param pBsAux bitstream reader auxiliary
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* 1 - failed
|
* 1 - failed
|
||||||
*
|
*
|
||||||
* \note Call it in case eNalUnitType is PPS.
|
* \note Call it in case eNalUnitType is PPS.
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux, uint8_t* pSrcNal,
|
int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux, uint8_t* pSrcNal,
|
||||||
@@ -1440,15 +1440,15 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux,
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief to parse SEI message payload
|
* \brief to parse SEI message payload
|
||||||
*
|
*
|
||||||
* \param pSei sei message to be parsed output
|
* \param pSei sei message to be parsed output
|
||||||
* \param pBsAux bitstream reader auxiliary
|
* \param pBsAux bitstream reader auxiliary
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* 1 - failed
|
* 1 - failed
|
||||||
*
|
*
|
||||||
* \note Call it in case eNalUnitType is NAL_UNIT_SEI.
|
* \note Call it in case eNalUnitType is NAL_UNIT_SEI.
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t ParseSei (void* pSei, PBitStringAux pBsAux) { // reserved Sei_Msg type
|
int32_t ParseSei (void* pSei, PBitStringAux pBsAux) { // reserved Sei_Msg type
|
||||||
@@ -1458,15 +1458,15 @@ int32_t ParseSei (void* pSei, PBitStringAux pBsAux) { // reserved Sei_Msg type
|
|||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief to parse scalinglist message payload
|
* \brief to parse scalinglist message payload
|
||||||
*
|
*
|
||||||
* \param pps sps scaling list matrix message to be parsed output
|
* \param pps sps scaling list matrix message to be parsed output
|
||||||
* \param pBsAux bitstream reader auxiliary
|
* \param pBsAux bitstream reader auxiliary
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* 1 - failed
|
* 1 - failed
|
||||||
*
|
*
|
||||||
* \note Call it in case scaling list matrix present at sps or pps level
|
* \note Call it in case scaling list matrix present at sps or pps level
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t SetScalingListValue (uint8_t* pScalingList, int iScalingListNum, bool* bUseDefaultScalingMatrixFlag,
|
int32_t SetScalingListValue (uint8_t* pScalingList, int iScalingListNum, bool* bUseDefaultScalingMatrixFlag,
|
||||||
@@ -1561,11 +1561,11 @@ int32_t ParseScalingList (PSps pSps, PBitStringAux pBs, bool bPPS, bool* pScalin
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief reset fmo list due to got Sps now
|
* \brief reset fmo list due to got Sps now
|
||||||
*
|
*
|
||||||
* \param pCtx decoder context
|
* \param pCtx decoder context
|
||||||
*
|
*
|
||||||
* \return count number of fmo context units are reset
|
* \return count number of fmo context units are reset
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t ResetFmoList (PWelsDecoderContext pCtx) {
|
int32_t ResetFmoList (PWelsDecoderContext pCtx) {
|
||||||
|
|||||||
@@ -59,13 +59,13 @@ int32_t InitReadBits (PBitStringAux pBitString, intX_t iEndOffset) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief input bits for decoder or initialize bitstream writing in encoder
|
* \brief input bits for decoder or initialize bitstream writing in encoder
|
||||||
*
|
*
|
||||||
* \param pBitString Bit string auxiliary pointer
|
* \param pBitString Bit string auxiliary pointer
|
||||||
* \param kpBuf bit-stream buffer
|
* \param kpBuf bit-stream buffer
|
||||||
* \param kiSize size in bits for decoder; size in bytes for encoder
|
* \param kiSize size in bits for decoder; size in bytes for encoder
|
||||||
*
|
*
|
||||||
* \return 0: success, other: fail
|
* \return 0: success, other: fail
|
||||||
*/
|
*/
|
||||||
int32_t DecInitBits (PBitStringAux pBitString, const uint8_t* kpBuf, const int32_t kiSize) {
|
int32_t DecInitBits (PBitStringAux pBitString, const uint8_t* kpBuf, const int32_t kiSize) {
|
||||||
const int32_t kiSizeBuf = (kiSize + 7) >> 3;
|
const int32_t kiSizeBuf = (kiSize + 7) >> 3;
|
||||||
|
|||||||
@@ -863,11 +863,11 @@ void WelsDeblockingMb (PDqLayer pCurDqLayer, PDeblockingFilter pFilter, int32_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief AVC slice deblocking filtering target layer
|
* \brief AVC slice deblocking filtering target layer
|
||||||
*
|
*
|
||||||
* \param dec Wels avc decoder context
|
* \param dec Wels avc decoder context
|
||||||
*
|
*
|
||||||
* \return NONE
|
* \return NONE
|
||||||
*/
|
*/
|
||||||
void WelsDeblockingFilterSlice (PWelsDecoderContext pCtx, PDeblockingFilterMbFunc pDeblockMb) {
|
void WelsDeblockingFilterSlice (PWelsDecoderContext pCtx, PDeblockingFilterMbFunc pDeblockMb) {
|
||||||
PDqLayer pCurDqLayer = pCtx->pCurDqLayer;
|
PDqLayer pCurDqLayer = pCtx->pCurDqLayer;
|
||||||
@@ -932,12 +932,12 @@ void WelsDeblockingFilterSlice (PWelsDecoderContext pCtx, PDeblockingFilterMbFun
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
* \brief deblocking module initialize
|
* \brief deblocking module initialize
|
||||||
*
|
*
|
||||||
* \param pf
|
* \param pf
|
||||||
* cpu
|
* cpu
|
||||||
*
|
*
|
||||||
* \return NONE
|
* \return NONE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void DeblockingInit (SDeblockingFunc* pFunc, int32_t iCpu) {
|
void DeblockingInit (SDeblockingFunc* pFunc, int32_t iCpu) {
|
||||||
|
|||||||
@@ -323,12 +323,12 @@ void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* destory_mb_blocks
|
* destory_mb_blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get size of reference picture list in target layer incoming, = (iNumRefFrames
|
* get size of reference picture list in target layer incoming, = (iNumRefFrames
|
||||||
*/
|
*/
|
||||||
static inline int32_t GetTargetRefListSize (PWelsDecoderContext pCtx) {
|
static inline int32_t GetTargetRefListSize (PWelsDecoderContext pCtx) {
|
||||||
int32_t iNumRefFrames = 0;
|
int32_t iNumRefFrames = 0;
|
||||||
@@ -350,7 +350,7 @@ static inline int32_t GetTargetRefListSize (PWelsDecoderContext pCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* request memory blocks for decoder avc part
|
* request memory blocks for decoder avc part
|
||||||
*/
|
*/
|
||||||
int32_t WelsRequestMem (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight) {
|
int32_t WelsRequestMem (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight) {
|
||||||
const int32_t kiPicWidth = kiMbWidth << 4;
|
const int32_t kiPicWidth = kiMbWidth << 4;
|
||||||
@@ -431,7 +431,7 @@ int32_t WelsRequestMem (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* free memory blocks in avc
|
* free memory blocks in avc
|
||||||
*/
|
*/
|
||||||
void WelsFreeMem (PWelsDecoderContext pCtx) {
|
void WelsFreeMem (PWelsDecoderContext pCtx) {
|
||||||
int32_t iListIdx = 0;
|
int32_t iListIdx = 0;
|
||||||
@@ -460,7 +460,7 @@ void WelsFreeMem (PWelsDecoderContext pCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Open decoder
|
* \brief Open decoder
|
||||||
*/
|
*/
|
||||||
int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) {
|
int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) {
|
||||||
// function pointers
|
// function pointers
|
||||||
@@ -492,7 +492,7 @@ int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Close decoder
|
* \brief Close decoder
|
||||||
*/
|
*/
|
||||||
void WelsCloseDecoder (PWelsDecoderContext pCtx) {
|
void WelsCloseDecoder (PWelsDecoderContext pCtx) {
|
||||||
WelsFreeMem (pCtx);
|
WelsFreeMem (pCtx);
|
||||||
@@ -511,7 +511,7 @@ void WelsCloseDecoder (PWelsDecoderContext pCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief configure decoder parameters
|
* \brief configure decoder parameters
|
||||||
*/
|
*/
|
||||||
int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpParam) {
|
int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpParam) {
|
||||||
if (NULL == pCtx || NULL == kpParam)
|
if (NULL == pCtx || NULL == kpParam)
|
||||||
@@ -549,14 +549,14 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief Initialize Wels decoder parameters and memory
|
* \brief Initialize Wels decoder parameters and memory
|
||||||
*
|
*
|
||||||
* \param pCtx input context to be initialized at first stage
|
* \param pCtx input context to be initialized at first stage
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* \return 1 - failed
|
* \return 1 - failed
|
||||||
*
|
*
|
||||||
* \note N/A
|
* \note N/A
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t WelsInitDecoder (PWelsDecoderContext pCtx, const bool bParseOnly, SLogContext* pLogCtx) {
|
int32_t WelsInitDecoder (PWelsDecoderContext pCtx, const bool bParseOnly, SLogContext* pLogCtx) {
|
||||||
@@ -574,13 +574,13 @@ int32_t WelsInitDecoder (PWelsDecoderContext pCtx, const bool bParseOnly, SLogCo
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief Uninitialize Wels decoder parameters and memory
|
* \brief Uninitialize Wels decoder parameters and memory
|
||||||
*
|
*
|
||||||
* \param pCtx input context to be uninitialized at release stage
|
* \param pCtx input context to be uninitialized at release stage
|
||||||
*
|
*
|
||||||
* \return NONE
|
* \return NONE
|
||||||
*
|
*
|
||||||
* \note N/A
|
* \note N/A
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
void WelsEndDecoder (PWelsDecoderContext pCtx) {
|
void WelsEndDecoder (PWelsDecoderContext pCtx) {
|
||||||
@@ -598,18 +598,18 @@ void GetVclNalTemporalId (PWelsDecoderContext pCtx) {
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief First entrance to decoding core interface.
|
* \brief First entrance to decoding core interface.
|
||||||
*
|
*
|
||||||
* \param pCtx decoder context
|
* \param pCtx decoder context
|
||||||
* \param pBufBs bit streaming buffer
|
* \param pBufBs bit streaming buffer
|
||||||
* \param kBsLen size in bytes length of bit streaming buffer input
|
* \param kBsLen size in bytes length of bit streaming buffer input
|
||||||
* \param ppDst picture payload data to be output
|
* \param ppDst picture payload data to be output
|
||||||
* \param pDstBufInfo buf information of ouput data
|
* \param pDstBufInfo buf information of ouput data
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* \return 1 - failed
|
* \return 1 - failed
|
||||||
*
|
*
|
||||||
* \note N/A
|
* \note N/A
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const int32_t kiBsLen,
|
int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const int32_t kiBsLen,
|
||||||
@@ -807,13 +807,13 @@ int32_t DecoderSetCsp (PWelsDecoderContext pCtx, const int32_t kiColorFormat) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief make sure synchonozization picture resolution (get from slice header) among different parts (i.e, memory related and so on)
|
* \brief make sure synchonozization picture resolution (get from slice header) among different parts (i.e, memory related and so on)
|
||||||
* over decoder internal
|
* over decoder internal
|
||||||
* ( MB coordinate and parts of data within decoder context structure )
|
* ( MB coordinate and parts of data within decoder context structure )
|
||||||
* \param pCtx Wels decoder context
|
* \param pCtx Wels decoder context
|
||||||
* \param iMbWidth MB width
|
* \param iMbWidth MB width
|
||||||
* \pram iMbHeight MB height
|
* \pram iMbHeight MB height
|
||||||
* \return 0 - successful; none 0 - something wrong
|
* \return 0 - successful; none 0 - something wrong
|
||||||
*/
|
*/
|
||||||
int32_t SyncPictureResolutionExt (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight) {
|
int32_t SyncPictureResolutionExt (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight) {
|
||||||
int32_t iErr = ERR_NONE;
|
int32_t iErr = ERR_NONE;
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ int32_t ParsePredWeightedTable (PBitStringAux pBs, PSliceHeader pSh) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Predeclared function routines ..
|
* Predeclared function routines ..
|
||||||
*/
|
*/
|
||||||
int32_t ParseRefPicListReordering (PBitStringAux pBs, PSliceHeader pSh) {
|
int32_t ParseRefPicListReordering (PBitStringAux pBs, PSliceHeader pSh) {
|
||||||
int32_t iList = 0;
|
int32_t iList = 0;
|
||||||
@@ -538,7 +538,7 @@ int32_t CheckBsBuffer (PWelsDecoderContext pCtx, const int32_t kiSrcLen) {
|
|||||||
* Especially for:
|
* Especially for:
|
||||||
* rbsp_au_buffer, cur_dq_layer_ptr and ref_dq_layer_ptr in MB info cache.
|
* rbsp_au_buffer, cur_dq_layer_ptr and ref_dq_layer_ptr in MB info cache.
|
||||||
* return:
|
* return:
|
||||||
* 0 - success; otherwise returned error_no defined in error_no.h.
|
* 0 - success; otherwise returned error_no defined in error_no.h.
|
||||||
*/
|
*/
|
||||||
int32_t WelsInitMemory (PWelsDecoderContext pCtx) {
|
int32_t WelsInitMemory (PWelsDecoderContext pCtx) {
|
||||||
if (pCtx == NULL) {
|
if (pCtx == NULL) {
|
||||||
@@ -600,11 +600,11 @@ void WelsFreeMemory (PWelsDecoderContext pCtx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* DecodeNalHeaderExt
|
* DecodeNalHeaderExt
|
||||||
* Trigger condition: NAL_UNIT_TYPE = NAL_UNIT_PREFIX or NAL_UNIT_CODED_SLICE_EXT
|
* Trigger condition: NAL_UNIT_TYPE = NAL_UNIT_PREFIX or NAL_UNIT_CODED_SLICE_EXT
|
||||||
* Parameter:
|
* Parameter:
|
||||||
* pNal: target NALUnit ptr
|
* pNal: target NALUnit ptr
|
||||||
* pSrc: NAL Unit bitstream
|
* pSrc: NAL Unit bitstream
|
||||||
*/
|
*/
|
||||||
void DecodeNalHeaderExt (PNalUnit pNal, uint8_t* pSrc) {
|
void DecodeNalHeaderExt (PNalUnit pNal, uint8_t* pSrc) {
|
||||||
PNalUnitHeaderExt pHeaderExt = &pNal->sNalHeaderExt;
|
PNalUnitHeaderExt pHeaderExt = &pNal->sNalHeaderExt;
|
||||||
@@ -636,8 +636,8 @@ void DecodeNalHeaderExt (PNalUnit pNal, uint8_t* pSrc) {
|
|||||||
#define MAX_NUM_REF_IDX_L0_ACTIVE_MINUS1 15
|
#define MAX_NUM_REF_IDX_L0_ACTIVE_MINUS1 15
|
||||||
#define SLICE_HEADER_CABAC_INIT_IDC_MAX 2
|
#define SLICE_HEADER_CABAC_INIT_IDC_MAX 2
|
||||||
/*
|
/*
|
||||||
* decode_slice_header_avc
|
* decode_slice_header_avc
|
||||||
* Parse slice header of bitstream in avc for storing data structure
|
* Parse slice header of bitstream in avc for storing data structure
|
||||||
*/
|
*/
|
||||||
int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, const bool kbExtensionFlag) {
|
int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, const bool kbExtensionFlag) {
|
||||||
PNalUnit const kpCurNal = pCtx->pAccessUnitList->pNalUnitsList[pCtx->pAccessUnitList->uiAvailUnitsNum - 1];
|
PNalUnit const kpCurNal = pCtx->pAccessUnitList->pNalUnitsList[pCtx->pAccessUnitList->uiAvailUnitsNum - 1];
|
||||||
@@ -1108,9 +1108,9 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy relative syntax elements of NALUnitHeaderExt, sRefPicBaseMarking and bStoreRefBasePicFlag in prefix nal unit.
|
* Copy relative syntax elements of NALUnitHeaderExt, sRefPicBaseMarking and bStoreRefBasePicFlag in prefix nal unit.
|
||||||
* pSrc: mark as decoded prefix NAL
|
* pSrc: mark as decoded prefix NAL
|
||||||
* ppDst: succeeded VCL NAL based AVC (I/P Slice)
|
* ppDst: succeeded VCL NAL based AVC (I/P Slice)
|
||||||
*/
|
*/
|
||||||
bool PrefetchNalHeaderExtSyntax (PWelsDecoderContext pCtx, PNalUnit const kppDst, PNalUnit const kpSrc) {
|
bool PrefetchNalHeaderExtSyntax (PWelsDecoderContext pCtx, PNalUnit const kppDst, PNalUnit const kpSrc) {
|
||||||
PNalUnitHeaderExt pNalHdrExtD = NULL, pNalHdrExtS = NULL;
|
PNalUnitHeaderExt pNalHdrExtD = NULL, pNalHdrExtS = NULL;
|
||||||
@@ -1507,9 +1507,9 @@ void ResetCurrentAccessUnit (PWelsDecoderContext pCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Force reset current Acess Unit Nal list in case error parsing/decoding in current AU
|
* \brief Force reset current Acess Unit Nal list in case error parsing/decoding in current AU
|
||||||
* \author
|
* \author
|
||||||
* \history 11/16/2009
|
* \history 11/16/2009
|
||||||
*/
|
*/
|
||||||
void ForceResetCurrentAccessUnit (PAccessUnit pAu) {
|
void ForceResetCurrentAccessUnit (PAccessUnit pAu) {
|
||||||
uint32_t uiSucAuIdx = pAu->uiEndPos + 1;
|
uint32_t uiSucAuIdx = pAu->uiEndPos + 1;
|
||||||
@@ -1929,12 +1929,12 @@ void DecodeFinishUpdate (PWelsDecoderContext pCtx) {
|
|||||||
* construct an access unit for given input bitstream, maybe partial NAL Unit, one or more Units are involved to
|
* construct an access unit for given input bitstream, maybe partial NAL Unit, one or more Units are involved to
|
||||||
* joint a collective access unit.
|
* joint a collective access unit.
|
||||||
* parameter\
|
* parameter\
|
||||||
* buf: bitstream data buffer
|
* buf: bitstream data buffer
|
||||||
* bit_len: size in bit length of data
|
* bit_len: size in bit length of data
|
||||||
* buf_len: size in byte length of data
|
* buf_len: size in byte length of data
|
||||||
* coded_au: mark an Access Unit decoding finished
|
* coded_au: mark an Access Unit decoding finished
|
||||||
* return:
|
* return:
|
||||||
* 0 - success; otherwise returned error_no defined in error_no.h
|
* 0 - success; otherwise returned error_no defined in error_no.h
|
||||||
*/
|
*/
|
||||||
int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {
|
int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {
|
||||||
int32_t iErr;
|
int32_t iErr;
|
||||||
@@ -2152,7 +2152,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
|
|||||||
memset (&pLayerInfo, 0, sizeof (SLayerInfo));
|
memset (&pLayerInfo, 0, sizeof (SLayerInfo));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loop decoding for slices (even FMO and/ multiple slices) within a dq layer
|
* Loop decoding for slices (even FMO and/ multiple slices) within a dq layer
|
||||||
*/
|
*/
|
||||||
while (iIdx <= iEndIdx) {
|
while (iIdx <= iEndIdx) {
|
||||||
bool bReconstructSlice;
|
bool bReconstructSlice;
|
||||||
|
|||||||
@@ -44,12 +44,12 @@
|
|||||||
namespace WelsDec {
|
namespace WelsDec {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Generate MB allocated map for interleaved slice group (TYPE 0)
|
* \brief Generate MB allocated map for interleaved slice group (TYPE 0)
|
||||||
*
|
*
|
||||||
* \param pFmo fmo context
|
* \param pFmo fmo context
|
||||||
* \param pPps pps context
|
* \param pPps pps context
|
||||||
*
|
*
|
||||||
* \return 0 - successful; none 0 - failed
|
* \return 0 - successful; none 0 - failed
|
||||||
*/
|
*/
|
||||||
static inline int32_t FmoGenerateMbAllocMapType0 (PFmo pFmo, PPps pPps) {
|
static inline int32_t FmoGenerateMbAllocMapType0 (PFmo pFmo, PPps pPps) {
|
||||||
uint32_t uiNumSliceGroups = 0;
|
uint32_t uiNumSliceGroups = 0;
|
||||||
@@ -79,13 +79,13 @@ static inline int32_t FmoGenerateMbAllocMapType0 (PFmo pFmo, PPps pPps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Generate MB allocated map for dispersed slice group (TYPE 1)
|
* \brief Generate MB allocated map for dispersed slice group (TYPE 1)
|
||||||
*
|
*
|
||||||
* \param pFmo fmo context
|
* \param pFmo fmo context
|
||||||
* \param pPps pps context
|
* \param pPps pps context
|
||||||
* \param iMbWidth MB width
|
* \param iMbWidth MB width
|
||||||
*
|
*
|
||||||
* \return 0 - successful; none 0 - failed
|
* \return 0 - successful; none 0 - failed
|
||||||
*/
|
*/
|
||||||
static inline int32_t FmoGenerateMbAllocMapType1 (PFmo pFmo, PPps pPps, const int32_t kiMbWidth) {
|
static inline int32_t FmoGenerateMbAllocMapType1 (PFmo pFmo, PPps pPps, const int32_t kiMbWidth) {
|
||||||
uint32_t uiNumSliceGroups = 0;
|
uint32_t uiNumSliceGroups = 0;
|
||||||
@@ -106,14 +106,14 @@ static inline int32_t FmoGenerateMbAllocMapType1 (PFmo pFmo, PPps pPps, const in
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Generate MB allocated map for various type of slice group cases (TYPE 0, .., 6)
|
* \brief Generate MB allocated map for various type of slice group cases (TYPE 0, .., 6)
|
||||||
*
|
*
|
||||||
* \param pFmo fmo context
|
* \param pFmo fmo context
|
||||||
* \param pPps pps context
|
* \param pPps pps context
|
||||||
* \param kiMbWidth MB width
|
* \param kiMbWidth MB width
|
||||||
* \param kiMbHeight MB height
|
* \param kiMbHeight MB height
|
||||||
*
|
*
|
||||||
* \return 0 - successful; none 0 - failed
|
* \return 0 - successful; none 0 - failed
|
||||||
*/
|
*/
|
||||||
static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const int32_t kiMbWidth,
|
static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const int32_t kiMbWidth,
|
||||||
const int32_t kiMbHeight) {
|
const int32_t kiMbHeight) {
|
||||||
@@ -177,14 +177,14 @@ static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Initialize Wels Flexible Macroblock Ordering (FMO)
|
* \brief Initialize Wels Flexible Macroblock Ordering (FMO)
|
||||||
*
|
*
|
||||||
* \param pFmo Wels fmo to be initialized
|
* \param pFmo Wels fmo to be initialized
|
||||||
* \param pPps pps argument
|
* \param pPps pps argument
|
||||||
* \param kiMbWidth mb width
|
* \param kiMbWidth mb width
|
||||||
* \param kiMbHeight mb height
|
* \param kiMbHeight mb height
|
||||||
*
|
*
|
||||||
* \return 0 - successful; none 0 - failed;
|
* \return 0 - successful; none 0 - failed;
|
||||||
*/
|
*/
|
||||||
int32_t InitFmo (PFmo pFmo, PPps pPps, const int32_t kiMbWidth, const int32_t kiMbHeight) {
|
int32_t InitFmo (PFmo pFmo, PPps pPps, const int32_t kiMbWidth, const int32_t kiMbHeight) {
|
||||||
return FmoGenerateSliceGroup (pFmo, pPps, kiMbWidth, kiMbHeight);
|
return FmoGenerateSliceGroup (pFmo, pPps, kiMbWidth, kiMbHeight);
|
||||||
@@ -192,13 +192,13 @@ int32_t InitFmo (PFmo pFmo, PPps pPps, const int32_t kiMbWidth, const int32_t ki
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Uninitialize Wels Flexible Macroblock Ordering (FMO) list
|
* \brief Uninitialize Wels Flexible Macroblock Ordering (FMO) list
|
||||||
*
|
*
|
||||||
* \param pFmo Wels base fmo ptr to be uninitialized
|
* \param pFmo Wels base fmo ptr to be uninitialized
|
||||||
* \param kiCnt count number of PPS per list
|
* \param kiCnt count number of PPS per list
|
||||||
* \param kiAvail count available number of PPS in list
|
* \param kiAvail count available number of PPS in list
|
||||||
*
|
*
|
||||||
* \return NONE
|
* \return NONE
|
||||||
*/
|
*/
|
||||||
void UninitFmoList (PFmo pFmo, const int32_t kiCnt, const int32_t kiAvail) {
|
void UninitFmoList (PFmo pFmo, const int32_t kiCnt, const int32_t kiAvail) {
|
||||||
PFmo pIter = pFmo;
|
PFmo pIter = pFmo;
|
||||||
@@ -229,14 +229,14 @@ void UninitFmoList (PFmo pFmo, const int32_t kiCnt, const int32_t kiAvail) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief detect parameter sets are changed or not
|
* \brief detect parameter sets are changed or not
|
||||||
*
|
*
|
||||||
* \param pFmo fmo context
|
* \param pFmo fmo context
|
||||||
* \param kiCountNumMb (iMbWidth * iMbHeight) in Sps
|
* \param kiCountNumMb (iMbWidth * iMbHeight) in Sps
|
||||||
* \param iSliceGroupType slice group type if fmo is exactly enabled
|
* \param iSliceGroupType slice group type if fmo is exactly enabled
|
||||||
* \param iSliceGroupCount slice group count if fmo is exactly enabled
|
* \param iSliceGroupCount slice group count if fmo is exactly enabled
|
||||||
*
|
*
|
||||||
* \return true - changed or not initialized yet; false - not change at all
|
* \return true - changed or not initialized yet; false - not change at all
|
||||||
*/
|
*/
|
||||||
bool FmoParamSetsChanged (PFmo pFmo, const int32_t kiCountNumMb, const int32_t kiSliceGroupType,
|
bool FmoParamSetsChanged (PFmo pFmo, const int32_t kiCountNumMb, const int32_t kiSliceGroupType,
|
||||||
const int32_t kiSliceGroupCount) {
|
const int32_t kiSliceGroupCount) {
|
||||||
@@ -249,14 +249,14 @@ bool FmoParamSetsChanged (PFmo pFmo, const int32_t kiCountNumMb, const int32_t k
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief update/insert FMO parameter unit
|
* \brief update/insert FMO parameter unit
|
||||||
*
|
*
|
||||||
* \param _fmo FMO context
|
* \param _fmo FMO context
|
||||||
* \param _sps PSps
|
* \param _sps PSps
|
||||||
* \param _pps PPps
|
* \param _pps PPps
|
||||||
* \param pActiveFmoNum int32_t* [in/out]
|
* \param pActiveFmoNum int32_t* [in/out]
|
||||||
*
|
*
|
||||||
* \return true - update/insert successfully; false - failed;
|
* \return true - update/insert successfully; false - failed;
|
||||||
*/
|
*/
|
||||||
bool FmoParamUpdate (PFmo pFmo, PSps pSps, PPps pPps, int32_t* pActiveFmoNum) {
|
bool FmoParamUpdate (PFmo pFmo, PSps pSps, PPps pPps, int32_t* pActiveFmoNum) {
|
||||||
const uint32_t kuiMbWidth = pSps->iMbWidth;
|
const uint32_t kuiMbWidth = pSps->iMbWidth;
|
||||||
@@ -281,12 +281,12 @@ bool FmoParamUpdate (PFmo pFmo, PSps pSps, PPps pPps, int32_t* pActiveFmoNum) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Convert kMbXy to slice group idc correspondingly
|
* \brief Convert kMbXy to slice group idc correspondingly
|
||||||
*
|
*
|
||||||
* \param pFmo Wels fmo context
|
* \param pFmo Wels fmo context
|
||||||
* \param kMbXy kMbXy to be converted
|
* \param kMbXy kMbXy to be converted
|
||||||
*
|
*
|
||||||
* \return slice group idc - successful; -1 - failed;
|
* \return slice group idc - successful; -1 - failed;
|
||||||
*/
|
*/
|
||||||
int32_t FmoMbToSliceGroup (PFmo pFmo, const MB_XY_T kiMbXy) {
|
int32_t FmoMbToSliceGroup (PFmo pFmo, const MB_XY_T kiMbXy) {
|
||||||
const int32_t kiMbNum = pFmo->iCountMbNum;
|
const int32_t kiMbNum = pFmo->iCountMbNum;
|
||||||
@@ -299,12 +299,12 @@ int32_t FmoMbToSliceGroup (PFmo pFmo, const MB_XY_T kiMbXy) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get successive mb to be processed with given current kMbXy
|
* \brief Get successive mb to be processed with given current kMbXy
|
||||||
*
|
*
|
||||||
* \param pFmo Wels fmo context
|
* \param pFmo Wels fmo context
|
||||||
* \param kMbXy current kMbXy
|
* \param kMbXy current kMbXy
|
||||||
*
|
*
|
||||||
* \return iNextMb - successful; -1 - failed;
|
* \return iNextMb - successful; -1 - failed;
|
||||||
*/
|
*/
|
||||||
MB_XY_T FmoNextMb (PFmo pFmo, const MB_XY_T kiMbXy) {
|
MB_XY_T FmoNextMb (PFmo pFmo, const MB_XY_T kiMbXy) {
|
||||||
const int32_t kiTotalMb = pFmo->iCountMbNum;
|
const int32_t kiTotalMb = pFmo->iCountMbNum;
|
||||||
|
|||||||
@@ -122,9 +122,9 @@ int32_t ExpandNalUnitList (PAccessUnit* ppAu, const int32_t kiOrgSize, const int
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MemGetNextNal
|
* MemGetNextNal
|
||||||
* Get next NAL Unit for using.
|
* Get next NAL Unit for using.
|
||||||
* Need expand NAL Unit list if exceeding count number of available NAL Units withing an Access Unit
|
* Need expand NAL Unit list if exceeding count number of available NAL Units withing an Access Unit
|
||||||
*/
|
*/
|
||||||
PNalUnit MemGetNextNal (PAccessUnit* ppAu) {
|
PNalUnit MemGetNextNal (PAccessUnit* ppAu) {
|
||||||
PAccessUnit pAu = *ppAu;
|
PAccessUnit pAu = *ppAu;
|
||||||
|
|||||||
@@ -48,12 +48,12 @@ void FreePicture (PPicture pPic);
|
|||||||
|
|
||||||
|
|
||||||
///////////////////////////////////Recycled queue management for pictures///////////////////////////////////
|
///////////////////////////////////Recycled queue management for pictures///////////////////////////////////
|
||||||
/* ______________________________________
|
/* ______________________________________
|
||||||
-->| P0 | P1 | P2 | P3 | P4 | .. | Pn-1 |-->
|
-->| P0 | P1 | P2 | P3 | P4 | .. | Pn-1 |-->
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
*
|
*
|
||||||
* How does it work?
|
* How does it work?
|
||||||
* node <- next; ++ next;
|
* node <- next; ++ next;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -63,16 +63,16 @@ virtual long EXTAPI Initialize (const SDecodingParam* pParam);
|
|||||||
virtual long EXTAPI Uninitialize();
|
virtual long EXTAPI Uninitialize();
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Description:
|
* Description:
|
||||||
* Decompress one frame, and output I420 or RGB24(in the future) decoded stream and its length.
|
* Decompress one frame, and output I420 or RGB24(in the future) decoded stream and its length.
|
||||||
* Input parameters:
|
* Input parameters:
|
||||||
* Parameter TYPE Description
|
* Parameter TYPE Description
|
||||||
* pSrc unsigned char* the h264 stream to decode
|
* pSrc unsigned char* the h264 stream to decode
|
||||||
* srcLength int the length of h264 steam
|
* srcLength int the length of h264 steam
|
||||||
* pDst unsigned char* buffer pointer of decoded data
|
* pDst unsigned char* buffer pointer of decoded data
|
||||||
* pDstInfo SBufferInfo& information provided to API including width, height, SW/HW option, etc
|
* pDstInfo SBufferInfo& information provided to API including width, height, SW/HW option, etc
|
||||||
*
|
*
|
||||||
* return: if decode frame success return 0, otherwise corresponding error returned.
|
* return: if decode frame success return 0, otherwise corresponding error returned.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
virtual DECODING_STATE EXTAPI DecodeFrame (const unsigned char* kpSrc,
|
virtual DECODING_STATE EXTAPI DecodeFrame (const unsigned char* kpSrc,
|
||||||
const int kiSrcLen,
|
const int kiSrcLen,
|
||||||
|
|||||||
@@ -78,13 +78,13 @@ namespace WelsDec {
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Description:
|
* Description:
|
||||||
* class CWelsDecoder constructor function, do initialization and
|
* class CWelsDecoder constructor function, do initialization and
|
||||||
* alloc memory required
|
* alloc memory required
|
||||||
*
|
*
|
||||||
* Input parameters: none
|
* Input parameters: none
|
||||||
*
|
*
|
||||||
* return: none
|
* return: none
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
CWelsDecoder::CWelsDecoder (void)
|
CWelsDecoder::CWelsDecoder (void)
|
||||||
: m_pDecContext (NULL),
|
: m_pDecContext (NULL),
|
||||||
@@ -155,12 +155,12 @@ CWelsDecoder::CWelsDecoder (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Description:
|
* Description:
|
||||||
* class CWelsDecoder destructor function, destroy allocced memory
|
* class CWelsDecoder destructor function, destroy allocced memory
|
||||||
*
|
*
|
||||||
* Input parameters: none
|
* Input parameters: none
|
||||||
*
|
*
|
||||||
* return: none
|
* return: none
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
CWelsDecoder::~CWelsDecoder() {
|
CWelsDecoder::~CWelsDecoder() {
|
||||||
if (m_pWelsTrace != NULL) {
|
if (m_pWelsTrace != NULL) {
|
||||||
@@ -327,7 +327,7 @@ long CWelsDecoder::SetOption (DECODER_OPTION eOptID, void* pOption) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get Option
|
* Get Option
|
||||||
*/
|
*/
|
||||||
long CWelsDecoder::GetOption (DECODER_OPTION eOptID, void* pOption) {
|
long CWelsDecoder::GetOption (DECODER_OPTION eOptID, void* pOption) {
|
||||||
int iVal = 0;
|
int iVal = 0;
|
||||||
@@ -669,8 +669,8 @@ int WelsGetDecoderCapability (SDecoderCapability* pDecCapability) {
|
|||||||
/* WINAPI is indeed in prefix due to sync to application layer callings!! */
|
/* WINAPI is indeed in prefix due to sync to application layer callings!! */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* WelsCreateDecoder
|
* WelsCreateDecoder
|
||||||
* @return: success in return 0, otherwise failed.
|
* @return: success in return 0, otherwise failed.
|
||||||
*/
|
*/
|
||||||
long WelsCreateDecoder (ISVCDecoder** ppDecoder) {
|
long WelsCreateDecoder (ISVCDecoder** ppDecoder) {
|
||||||
|
|
||||||
@@ -688,7 +688,7 @@ long WelsCreateDecoder (ISVCDecoder** ppDecoder) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* WelsDestroyDecoder
|
* WelsDestroyDecoder
|
||||||
*/
|
*/
|
||||||
void WelsDestroyDecoder (ISVCDecoder* pDecoder) {
|
void WelsDestroyDecoder (ISVCDecoder* pDecoder) {
|
||||||
if (NULL != pDecoder) {
|
if (NULL != pDecoder) {
|
||||||
|
|||||||
@@ -48,15 +48,15 @@
|
|||||||
namespace WelsEnc {
|
namespace WelsEnc {
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief to write Sequence Parameter Set (SPS)
|
* \brief to write Sequence Parameter Set (SPS)
|
||||||
*
|
*
|
||||||
* \param pSps SWelsSPS to be wrote
|
* \param pSps SWelsSPS to be wrote
|
||||||
* \param bs_aux bitstream writer auxiliary
|
* \param bs_aux bitstream writer auxiliary
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* 1 - failed
|
* 1 - failed
|
||||||
*
|
*
|
||||||
* \note Call it in case EWelsNalUnitType is SPS.
|
* \note Call it in case EWelsNalUnitType is SPS.
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -65,15 +65,15 @@ int32_t WelsWriteSpsNal (SWelsSPS* pSps, SBitStringAux* pBitStringAux, int32_t*
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief to write SubSet Sequence Parameter Set
|
* \brief to write SubSet Sequence Parameter Set
|
||||||
*
|
*
|
||||||
* \param sub_sps subset pSps parsed
|
* \param sub_sps subset pSps parsed
|
||||||
* \param bs_aux bitstream writer auxiliary
|
* \param bs_aux bitstream writer auxiliary
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* 1 - failed
|
* 1 - failed
|
||||||
*
|
*
|
||||||
* \note Call it in case EWelsNalUnitType is SubSet SPS.
|
* \note Call it in case EWelsNalUnitType is SubSet SPS.
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t WelsWriteSubsetSpsSyntax (SSubsetSps* pSubsetSps, SBitStringAux* pBitStringAux , int32_t* pSpsIdDelta);
|
int32_t WelsWriteSubsetSpsSyntax (SSubsetSps* pSubsetSps, SBitStringAux* pBitStringAux , int32_t* pSpsIdDelta);
|
||||||
@@ -81,27 +81,27 @@ int32_t WelsWriteSubsetSpsSyntax (SSubsetSps* pSubsetSps, SBitStringAux* pBitStr
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief to write Picture Parameter Set (PPS)
|
* \brief to write Picture Parameter Set (PPS)
|
||||||
*
|
*
|
||||||
* \param pPps pPps
|
* \param pPps pPps
|
||||||
* \param bs_aux bitstream writer auxiliary
|
* \param bs_aux bitstream writer auxiliary
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* 1 - failed
|
* 1 - failed
|
||||||
*
|
*
|
||||||
* \note Call it in case EWelsNalUnitType is PPS.
|
* \note Call it in case EWelsNalUnitType is PPS.
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t WelsWritePpsSyntax (SWelsPPS* pPps, SBitStringAux* pBitStringAux, SParaSetOffset* sPSOVector);
|
int32_t WelsWritePpsSyntax (SWelsPPS* pPps, SBitStringAux* pBitStringAux, SParaSetOffset* sPSOVector);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief initialize pSps based on configurable parameters in svc
|
* \brief initialize pSps based on configurable parameters in svc
|
||||||
* \param pSps SWelsSPS*
|
* \param pSps SWelsSPS*
|
||||||
* \param pLayerParam SSpatialLayerConfig dependency layer parameter
|
* \param pLayerParam SSpatialLayerConfig dependency layer parameter
|
||||||
* \param pLayerParamInternal SSpatialLayerInternal*, internal dependency layer parameter
|
* \param pLayerParamInternal SSpatialLayerInternal*, internal dependency layer parameter
|
||||||
* \param iSpsId SPS Id
|
* \param iSpsId SPS Id
|
||||||
* \return 0 - successful
|
* \return 0 - successful
|
||||||
* 1 - failed
|
* 1 - failed
|
||||||
*/
|
*/
|
||||||
int32_t WelsInitSps (SWelsSPS* pSps, SSpatialLayerConfig* pLayerParam, SSpatialLayerInternal* pLayerParamInternal,
|
int32_t WelsInitSps (SWelsSPS* pSps, SSpatialLayerConfig* pLayerParam, SSpatialLayerInternal* pLayerParamInternal,
|
||||||
const uint32_t kuiIntraPeriod, const int32_t kiNumRefFrame,
|
const uint32_t kuiIntraPeriod, const int32_t kiNumRefFrame,
|
||||||
@@ -109,13 +109,13 @@ int32_t WelsInitSps (SWelsSPS* pSps, SSpatialLayerConfig* pLayerParam, SSpatialL
|
|||||||
const int32_t kiDlayerCount,bool bSVCBaselayer);
|
const int32_t kiDlayerCount,bool bSVCBaselayer);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief initialize subset pSps based on configurable parameters in svc
|
* \brief initialize subset pSps based on configurable parameters in svc
|
||||||
* \param pSubsetSps SSubsetSps*
|
* \param pSubsetSps SSubsetSps*
|
||||||
* \param pLayerParam SSpatialLayerConfig dependency layer parameter
|
* \param pLayerParam SSpatialLayerConfig dependency layer parameter
|
||||||
* \param pLayerParamInternal SSpatialLayerInternal*, internal dependency layer parameter
|
* \param pLayerParamInternal SSpatialLayerInternal*, internal dependency layer parameter
|
||||||
* \param kiSpsId SPS Id
|
* \param kiSpsId SPS Id
|
||||||
* \return 0 - successful
|
* \return 0 - successful
|
||||||
* 1 - failed
|
* 1 - failed
|
||||||
*/
|
*/
|
||||||
int32_t WelsInitSubsetSps (SSubsetSps* pSubsetSps, SSpatialLayerConfig* pLayerParam,
|
int32_t WelsInitSubsetSps (SSubsetSps* pSubsetSps, SSpatialLayerConfig* pLayerParam,
|
||||||
SSpatialLayerInternal* pLayerParamInternal,
|
SSpatialLayerInternal* pLayerParamInternal,
|
||||||
@@ -124,15 +124,15 @@ int32_t WelsInitSubsetSps (SSubsetSps* pSubsetSps, SSpatialLayerConfig* pLayerPa
|
|||||||
const int32_t kiDlayerCount);
|
const int32_t kiDlayerCount);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief initialize pPps based on configurable parameters and pSps(subset pSps) in svc
|
* \brief initialize pPps based on configurable parameters and pSps(subset pSps) in svc
|
||||||
* \param pPps SWelsPPS*
|
* \param pPps SWelsPPS*
|
||||||
* \param pSps SWelsSPS*
|
* \param pSps SWelsSPS*
|
||||||
* \param pSubsetSps SSubsetSps*
|
* \param pSubsetSps SSubsetSps*
|
||||||
* \param kbDeblockingFilterPresentFlag bool
|
* \param kbDeblockingFilterPresentFlag bool
|
||||||
* \param kiPpsId PPS Id
|
* \param kiPpsId PPS Id
|
||||||
* \param kbUsingSubsetSps bool
|
* \param kbUsingSubsetSps bool
|
||||||
* \return 0 - successful
|
* \return 0 - successful
|
||||||
* 1 - failed
|
* 1 - failed
|
||||||
*/
|
*/
|
||||||
int32_t WelsInitPps (SWelsPPS* pPps,
|
int32_t WelsInitPps (SWelsPPS* pPps,
|
||||||
SWelsSPS* pSps,
|
SWelsSPS* pSps,
|
||||||
@@ -148,15 +148,15 @@ int32_t WelsCheckRefFrameLimitationLevelIdcFirst (SLogContext* pLogCtx, SWelsSvc
|
|||||||
int32_t WelsAdjustLevel (SSpatialLayerConfig* pSpatialLayer);
|
int32_t WelsAdjustLevel (SSpatialLayerConfig* pSpatialLayer);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief check if the current parameter can found a presenting sps
|
* \brief check if the current parameter can found a presenting sps
|
||||||
* \param pParam the current encoding paramter in SWelsSvcCodingParam
|
* \param pParam the current encoding paramter in SWelsSvcCodingParam
|
||||||
* \param kbUseSubsetSps bool
|
* \param kbUseSubsetSps bool
|
||||||
* \param iDlayerIndex int, the index of current D layer
|
* \param iDlayerIndex int, the index of current D layer
|
||||||
* \param iDlayerCount int, the number of total D layer
|
* \param iDlayerCount int, the number of total D layer
|
||||||
* \param pSpsArray array of all the stored SPSs
|
* \param pSpsArray array of all the stored SPSs
|
||||||
* \param pSubsetArray array of all the stored Subset-SPSs
|
* \param pSubsetArray array of all the stored Subset-SPSs
|
||||||
* \return 0 - successful
|
* \return 0 - successful
|
||||||
* -1 - cannot find existing SPS for current encoder parameter
|
* -1 - cannot find existing SPS for current encoder parameter
|
||||||
*/
|
*/
|
||||||
int32_t FindExistingSps (SWelsSvcCodingParam* pParam, const bool kbUseSubsetSps, const int32_t iDlayerIndex,
|
int32_t FindExistingSps (SWelsSvcCodingParam* pParam, const bool kbUseSubsetSps, const int32_t iDlayerIndex,
|
||||||
const int32_t iDlayerCount, const int32_t iSpsNumInUse,
|
const int32_t iDlayerCount, const int32_t iSpsNumInUse,
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
namespace WelsEnc {
|
namespace WelsEnc {
|
||||||
/*
|
/*
|
||||||
* Dependency Quality IDC
|
* Dependency Quality IDC
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct TagDqIdc {
|
typedef struct TagDqIdc {
|
||||||
|
|||||||
@@ -44,43 +44,43 @@
|
|||||||
|
|
||||||
namespace WelsEnc {
|
namespace WelsEnc {
|
||||||
/*!
|
/*!
|
||||||
* \brief request specific memory for SVC
|
* \brief request specific memory for SVC
|
||||||
* \param pEncCtx sWelsEncCtx*
|
* \param pEncCtx sWelsEncCtx*
|
||||||
* \return successful - 0; otherwise none 0 for failed
|
* \return successful - 0; otherwise none 0 for failed
|
||||||
*/
|
*/
|
||||||
int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingParasetList);
|
int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingParasetList);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief free memory in SVC core encoder
|
* \brief free memory in SVC core encoder
|
||||||
* \param pEncCtx sWelsEncCtx**
|
* \param pEncCtx sWelsEncCtx**
|
||||||
* \return none
|
* \return none
|
||||||
*/
|
*/
|
||||||
void FreeMemorySvc (sWelsEncCtx** ppCtx);
|
void FreeMemorySvc (sWelsEncCtx** ppCtx);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief allocate or reallocate the output bs buffer
|
* \brief allocate or reallocate the output bs buffer
|
||||||
* \return: successful - 0; otherwise none 0 for failed
|
* \return: successful - 0; otherwise none 0 for failed
|
||||||
*/
|
*/
|
||||||
int32_t AllocateBsOutputBuffer (CMemoryAlign* pMa, const int32_t iNeededLen, int32_t iOrigLen, const char* kpTag,
|
int32_t AllocateBsOutputBuffer (CMemoryAlign* pMa, const int32_t iNeededLen, int32_t iOrigLen, const char* kpTag,
|
||||||
uint8_t*& pOutputBuffer);
|
uint8_t*& pOutputBuffer);
|
||||||
//TODO: to finish this function and call it
|
//TODO: to finish this function and call it
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief initialize function pointers that potentially used in Wels encoding
|
* \brief initialize function pointers that potentially used in Wels encoding
|
||||||
* \param pEncCtx sWelsEncCtx*
|
* \param pEncCtx sWelsEncCtx*
|
||||||
* \return successful - 0; otherwise none 0 for failed
|
* \return successful - 0; otherwise none 0 for failed
|
||||||
*/
|
*/
|
||||||
int32_t InitFunctionPointers (sWelsEncCtx* pEncCtx, SWelsSvcCodingParam* _param, uint32_t uiCpuFlag);
|
int32_t InitFunctionPointers (sWelsEncCtx* pEncCtx, SWelsSvcCodingParam* _param, uint32_t uiCpuFlag);
|
||||||
|
|
||||||
///*!
|
///*!
|
||||||
// * \brief decide frame type (IDR/P frame)
|
// * \brief decide frame type (IDR/P frame)
|
||||||
// * \param uiFrameType frame type output
|
// * \param uiFrameType frame type output
|
||||||
// * \param frame_idx frame index elapsed currently
|
// * \param frame_idx frame index elapsed currently
|
||||||
// * \param idr IDR interval
|
// * \param idr IDR interval
|
||||||
// * \return successful - 0; otherwise none 0 for failed
|
// * \return successful - 0; otherwise none 0 for failed
|
||||||
// */
|
// */
|
||||||
/*!
|
/*!
|
||||||
* \brief initialize frame coding
|
* \brief initialize frame coding
|
||||||
*/
|
*/
|
||||||
void InitFrameCoding (sWelsEncCtx* pEncCtx, const EVideoFrameType keFrameType);
|
void InitFrameCoding (sWelsEncCtx* pEncCtx, const EVideoFrameType keFrameType);
|
||||||
|
|
||||||
@@ -88,24 +88,24 @@ EVideoFrameType DecideFrameType (sWelsEncCtx* pEncCtx, const int8_t kiSpatialNum
|
|||||||
|
|
||||||
int32_t GetTemporalLevel (SSpatialLayerInternal* fDlp, const int32_t kiFrameNum, const int32_t kiGopSize);
|
int32_t GetTemporalLevel (SSpatialLayerInternal* fDlp, const int32_t kiFrameNum, const int32_t kiGopSize);
|
||||||
/*!
|
/*!
|
||||||
* \brief Dump reconstruction for dependency layer
|
* \brief Dump reconstruction for dependency layer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern "C" void DumpDependencyRec (SPicture* pSrcPic, const char* kpFileName, const int8_t kiDid, bool bAppend, SDqLayer* pDqLayer);
|
extern "C" void DumpDependencyRec (SPicture* pSrcPic, const char* kpFileName, const int8_t kiDid, bool bAppend, SDqLayer* pDqLayer);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Dump the reconstruction pictures
|
* \brief Dump the reconstruction pictures
|
||||||
*/
|
*/
|
||||||
void DumpRecFrame (SPicture* pSrcPic, const char* kpFileName, const int8_t kiDid, bool bAppend, SDqLayer* pDqLayer);
|
void DumpRecFrame (SPicture* pSrcPic, const char* kpFileName, const int8_t kiDid, bool bAppend, SDqLayer* pDqLayer);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief encode overall slices pData in a frame
|
* \brief encode overall slices pData in a frame
|
||||||
* \param pEncCtx sWelsEncCtx*, encoder context
|
* \param pEncCtx sWelsEncCtx*, encoder context
|
||||||
* \param count_slice_num count number of slices in a frame
|
* \param count_slice_num count number of slices in a frame
|
||||||
* \param eNalType EWelsNalUnitType for a frame
|
* \param eNalType EWelsNalUnitType for a frame
|
||||||
* \param nal_idc EWelsNalRefIdc for a frame
|
* \param nal_idc EWelsNalRefIdc for a frame
|
||||||
* \return successful - 0; otherwise none 0 for failed
|
* \return successful - 0; otherwise none 0 for failed
|
||||||
*/
|
*/
|
||||||
int32_t EncodeFrame (sWelsEncCtx* pEncCtx,
|
int32_t EncodeFrame (sWelsEncCtx* pEncCtx,
|
||||||
const int32_t kiSliceNumCount,
|
const int32_t kiSliceNumCount,
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
namespace WelsEnc {
|
namespace WelsEnc {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* reference list for each quality layer in SVC
|
* reference list for each quality layer in SVC
|
||||||
*/
|
*/
|
||||||
typedef struct TagRefList {
|
typedef struct TagRefList {
|
||||||
SPicture* pShortRefList[1 + MAX_SHORT_REF_COUNT]; // reference list 0 - int16_t
|
SPicture* pShortRefList[1 + MAX_SHORT_REF_COUNT]; // reference list 0 - int16_t
|
||||||
|
|||||||
@@ -46,23 +46,23 @@
|
|||||||
namespace WelsEnc {
|
namespace WelsEnc {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief initialize source picture body
|
* \brief initialize source picture body
|
||||||
* \param kpSrc SSourcePicture*
|
* \param kpSrc SSourcePicture*
|
||||||
* \param kiCsp internal csp format
|
* \param kiCsp internal csp format
|
||||||
* \param kiWidth widht of picture in pixels
|
* \param kiWidth widht of picture in pixels
|
||||||
* \param kiHeight height of picture in pixels
|
* \param kiHeight height of picture in pixels
|
||||||
* \return successful - 0; otherwise none 0 for failed
|
* \return successful - 0; otherwise none 0 for failed
|
||||||
*/
|
*/
|
||||||
int32_t InitPic (const void* kpSrc, const int32_t kiCsp, const int32_t kiWidth, const int32_t kiHeight);
|
int32_t InitPic (const void* kpSrc, const int32_t kiCsp, const int32_t kiWidth, const int32_t kiHeight);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SVC core encoder external interfaces
|
* SVC core encoder external interfaces
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief validate checking in parameter configuration
|
* \brief validate checking in parameter configuration
|
||||||
* \pParam pParam SWelsSvcCodingParam*
|
* \pParam pParam SWelsSvcCodingParam*
|
||||||
* \return successful - 0; otherwise none 0 for failed
|
* \return successful - 0; otherwise none 0 for failed
|
||||||
*/
|
*/
|
||||||
int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pParam);
|
int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pParam);
|
||||||
|
|
||||||
@@ -70,28 +70,28 @@ int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pParam);
|
|||||||
void GomValidCheck (const int32_t kiMbWidth, const int32_t kiMbHeight, int32_t* pSliceNum);
|
void GomValidCheck (const int32_t kiMbWidth, const int32_t kiMbHeight, int32_t* pSliceNum);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief initialize Wels avc encoder core library
|
* \brief initialize Wels avc encoder core library
|
||||||
* \param ppCtx sWelsEncCtx**
|
* \param ppCtx sWelsEncCtx**
|
||||||
* \param para SWelsSvcCodingParam*
|
* \param para SWelsSvcCodingParam*
|
||||||
* \return successful - 0; otherwise none 0 for failed
|
* \return successful - 0; otherwise none 0 for failed
|
||||||
*/
|
*/
|
||||||
int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pPara, SLogContext* pLogCtx,
|
int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pPara, SLogContext* pLogCtx,
|
||||||
SExistingParasetList* pExistingParasetList);
|
SExistingParasetList* pExistingParasetList);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief uninitialize Wels encoder core library
|
* \brief uninitialize Wels encoder core library
|
||||||
* \param pEncCtx sWelsEncCtx*
|
* \param pEncCtx sWelsEncCtx*
|
||||||
* \return none
|
* \return none
|
||||||
*/
|
*/
|
||||||
void WelsUninitEncoderExt (sWelsEncCtx** ppCtx);
|
void WelsUninitEncoderExt (sWelsEncCtx** ppCtx);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief core svc encoding process
|
* \brief core svc encoding process
|
||||||
*
|
*
|
||||||
* \param h sWelsEncCtx*, encoder context
|
* \param h sWelsEncCtx*, encoder context
|
||||||
* \param pFbi FrameBSInfo*
|
* \param pFbi FrameBSInfo*
|
||||||
* \param kpSrcPic Source picture
|
* \param kpSrcPic Source picture
|
||||||
* \return EFrameType (videoFrameTypeIDR/videoFrameTypeI/videoFrameTypeP)
|
* \return EFrameType (videoFrameTypeIDR/videoFrameTypeI/videoFrameTypeP)
|
||||||
*/
|
*/
|
||||||
int32_t WelsEncoderEncodeExt (sWelsEncCtx*, SFrameBSInfo* pFbi, const SSourcePicture* kpSrcPic);
|
int32_t WelsEncoderEncodeExt (sWelsEncCtx*, SFrameBSInfo* pFbi, const SSourcePicture* kpSrcPic);
|
||||||
|
|
||||||
@@ -103,8 +103,8 @@ int32_t WelsEncoderEncodeParameterSets (sWelsEncCtx* pCtx, void* pDst);
|
|||||||
int32_t ForceCodingIDR (sWelsEncCtx* pCtx);
|
int32_t ForceCodingIDR (sWelsEncCtx* pCtx);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Wels SVC encoder parameters adjustment
|
* \brief Wels SVC encoder parameters adjustment
|
||||||
* SVC adjustment results in new requirement in memory blocks adjustment
|
* SVC adjustment results in new requirement in memory blocks adjustment
|
||||||
*/
|
*/
|
||||||
int32_t WelsBitRateVerification(SLogContext* pLogCtx,SSpatialLayerConfig* pLayerParam,int32_t iLayerId);
|
int32_t WelsBitRateVerification(SLogContext* pLogCtx,SSpatialLayerConfig* pLayerParam,int32_t iLayerId);
|
||||||
int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNew);
|
int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNew);
|
||||||
|
|||||||
@@ -41,15 +41,15 @@
|
|||||||
namespace WelsEnc {
|
namespace WelsEnc {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MB Cache information, such one cache should be defined within a slice
|
* MB Cache information, such one cache should be defined within a slice
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Cache for Luma Cache for Chroma(Cb, Cr)
|
* Cache for Luma Cache for Chroma(Cb, Cr)
|
||||||
*
|
*
|
||||||
* TL T T T T TL T T
|
* TL T T T T TL T T
|
||||||
* L - - - - L - -
|
* L - - - - L - -
|
||||||
* L - - - - L - - TR
|
* L - - - - L - - TR
|
||||||
* L - - - -
|
* L - - - -
|
||||||
* L - - - - TR
|
* L - - - - TR
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
#include "WelsThreadLib.h"
|
#include "WelsThreadLib.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MT_DEBUG: output trace MT related into log file
|
* MT_DEBUG: output trace MT related into log file
|
||||||
*/
|
*/
|
||||||
//#define MT_DEBUG
|
//#define MT_DEBUG
|
||||||
//#define ENABLE_TRACE_MT
|
//#define ENABLE_TRACE_MT
|
||||||
@@ -54,9 +54,9 @@
|
|||||||
|
|
||||||
#define DYNAMIC_DETECT_CPU_CORES
|
#define DYNAMIC_DETECT_CPU_CORES
|
||||||
|
|
||||||
#define THRESHOLD_RMSE_CORE8 0.0320f // v1.1: 0.0320f; v1.0: 0.02f
|
#define THRESHOLD_RMSE_CORE8 0.0320f // v1.1: 0.0320f; v1.0: 0.02f
|
||||||
#define THRESHOLD_RMSE_CORE4 0.0215f // v1.1: 0.0215f; v1.0: 0.03f
|
#define THRESHOLD_RMSE_CORE4 0.0215f // v1.1: 0.0215f; v1.0: 0.03f
|
||||||
#define THRESHOLD_RMSE_CORE2 0.0200f // v1.1: 0.0200f; v1.0: 0.04f
|
#define THRESHOLD_RMSE_CORE2 0.0200f // v1.1: 0.0200f; v1.0: 0.04f
|
||||||
|
|
||||||
typedef struct TagSliceThreadPrivateData {
|
typedef struct TagSliceThreadPrivateData {
|
||||||
void* pWelsPEncCtx;
|
void* pWelsPEncCtx;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ void UpdateP8x8MotionInfo (SMbCache* pMbCache, SMB* pCurMb, const int32_t kiPart
|
|||||||
/*!
|
/*!
|
||||||
* \brief get the motion predictor for 4*4 or 8*8 or 16*16 block
|
* \brief get the motion predictor for 4*4 or 8*8 or 16*16 block
|
||||||
* \param
|
* \param
|
||||||
* \param output mvp_x and mvp_y
|
* \param output mvp_x and mvp_y
|
||||||
*/
|
*/
|
||||||
void PredMv (const SMVComponentUnit* kpMvComp, int8_t iPartIdx, int8_t iPartW, int32_t iRef, SMVUnitXY* sMvp);
|
void PredMv (const SMVComponentUnit* kpMvComp, int8_t iPartIdx, int8_t iPartW, int32_t iRef, SMVUnitXY* sMvp);
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ void PredMv (const SMVComponentUnit* kpMvComp, int8_t iPartIdx, int8_t iPartW, i
|
|||||||
/*!
|
/*!
|
||||||
* \brief get the motion predictor for SKIP MB
|
* \brief get the motion predictor for SKIP MB
|
||||||
* \param
|
* \param
|
||||||
* \param output mvp_x and mvp_y
|
* \param output mvp_x and mvp_y
|
||||||
*/
|
*/
|
||||||
void PredSkipMv (SMbCache* pMbCache, SMVUnitXY* sMvp);
|
void PredSkipMv (SMbCache* pMbCache, SMVUnitXY* sMvp);
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ void PredSkipMv (SMbCache* pMbCache, SMVUnitXY* sMvp);
|
|||||||
/*!
|
/*!
|
||||||
* \brief get the motion predictor for inter16x8 MB
|
* \brief get the motion predictor for inter16x8 MB
|
||||||
* \param
|
* \param
|
||||||
* \param output mvp_x and mvp_y
|
* \param output mvp_x and mvp_y
|
||||||
*/
|
*/
|
||||||
void PredInter16x8Mv (SMbCache* pMbCache, int32_t iPartIdx, int8_t iRef, SMVUnitXY* sMvp);
|
void PredInter16x8Mv (SMbCache* pMbCache, int32_t iPartIdx, int8_t iRef, SMVUnitXY* sMvp);
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ void PredInter16x8Mv (SMbCache* pMbCache, int32_t iPartIdx, int8_t iRef, SMVUnit
|
|||||||
/*!
|
/*!
|
||||||
* \brief get the motion predictor for inter8x16 MB
|
* \brief get the motion predictor for inter8x16 MB
|
||||||
* \param
|
* \param
|
||||||
* \param output mvp_x and mvp_y
|
* \param output mvp_x and mvp_y
|
||||||
*/
|
*/
|
||||||
void PredInter8x16Mv (SMbCache* pMbCache, int32_t iPartIdx, int8_t iRef, SMVUnitXY* sMvp);
|
void PredInter8x16Mv (SMbCache* pMbCache, int32_t iPartIdx, int8_t iRef, SMVUnitXY* sMvp);
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace WelsEnc {
|
|||||||
|
|
||||||
#define NAL_HEADER_SIZE (4)
|
#define NAL_HEADER_SIZE (4)
|
||||||
/*
|
/*
|
||||||
* Raw payload pData for NAL unit, AVC/SVC compatible
|
* Raw payload pData for NAL unit, AVC/SVC compatible
|
||||||
*/
|
*/
|
||||||
typedef struct TagWelsNalRaw {
|
typedef struct TagWelsNalRaw {
|
||||||
uint8_t* pRawData; // pRawNal payload for slice pData
|
uint8_t* pRawData; // pRawNal payload for slice pData
|
||||||
@@ -63,7 +63,7 @@ int32_t iStartPos; //NAL start position in buffer
|
|||||||
} SWelsNalRaw;
|
} SWelsNalRaw;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Encoder majoy output pData
|
* Encoder majoy output pData
|
||||||
*/
|
*/
|
||||||
typedef struct TagWelsEncoderOutput {
|
typedef struct TagWelsEncoderOutput {
|
||||||
uint8_t* pBsBuffer; // overall bitstream pBuffer allocation for a coded picture, recycling use intend.
|
uint8_t* pBsBuffer; // overall bitstream pBuffer allocation for a coded picture, recycling use intend.
|
||||||
@@ -103,40 +103,40 @@ bool bSliceCodedFlag;
|
|||||||
} SWelsSliceBs;
|
} SWelsSliceBs;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief load an initialize NAL pRawNal pData
|
* \brief load an initialize NAL pRawNal pData
|
||||||
*/
|
*/
|
||||||
void WelsLoadNal (SWelsEncoderOutput* pEncoderOuput, const int32_t/*EWelsNalUnitType*/ kiType,
|
void WelsLoadNal (SWelsEncoderOutput* pEncoderOuput, const int32_t/*EWelsNalUnitType*/ kiType,
|
||||||
const int32_t/*EWelsNalRefIdc*/ kiNalRefIdc);
|
const int32_t/*EWelsNalRefIdc*/ kiNalRefIdc);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief unload pRawNal NAL
|
* \brief unload pRawNal NAL
|
||||||
*/
|
*/
|
||||||
void WelsUnloadNal (SWelsEncoderOutput* pEncoderOuput);
|
void WelsUnloadNal (SWelsEncoderOutput* pEncoderOuput);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief load an initialize NAL pRawNal pData
|
* \brief load an initialize NAL pRawNal pData
|
||||||
*/
|
*/
|
||||||
void WelsLoadNalForSlice (SWelsSliceBs* pSliceBs, const int32_t/*EWelsNalUnitType*/ kiType,
|
void WelsLoadNalForSlice (SWelsSliceBs* pSliceBs, const int32_t/*EWelsNalUnitType*/ kiType,
|
||||||
const int32_t/*EWelsNalRefIdc*/ kiNalRefIdc);
|
const int32_t/*EWelsNalRefIdc*/ kiNalRefIdc);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief unload pRawNal NAL
|
* \brief unload pRawNal NAL
|
||||||
*/
|
*/
|
||||||
void WelsUnloadNalForSlice (SWelsSliceBs* pSliceBs);
|
void WelsUnloadNalForSlice (SWelsSliceBs* pSliceBs);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief encode NAL with emulation forbidden three bytes checking
|
* \brief encode NAL with emulation forbidden three bytes checking
|
||||||
* \param pDst pDst NAL pData
|
* \param pDst pDst NAL pData
|
||||||
* \param pDstLen length of pDst NAL output
|
* \param pDstLen length of pDst NAL output
|
||||||
* \param annexeb annexeb flag
|
* \param annexeb annexeb flag
|
||||||
* \param pRawNal pRawNal NAL pData
|
* \param pRawNal pRawNal NAL pData
|
||||||
* \return ERR_CODE
|
* \return ERR_CODE
|
||||||
*/
|
*/
|
||||||
int32_t WelsEncodeNal (SWelsNalRaw* pRawNal, void* pNalHeaderExt, const int32_t kiDstBufferLen, void* pDst,
|
int32_t WelsEncodeNal (SWelsNalRaw* pRawNal, void* pNalHeaderExt, const int32_t kiDstBufferLen, void* pDst,
|
||||||
int32_t* pDstLen);
|
int32_t* pDstLen);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief write prefix nal
|
* \brief write prefix nal
|
||||||
*/
|
*/
|
||||||
int32_t WelsWriteSVCPrefixNal (SBitStringAux* pBitStringAux, const int32_t keNalRefIdc, const bool kbIdrFlag);
|
int32_t WelsWriteSVCPrefixNal (SBitStringAux* pBitStringAux, const int32_t keNalRefIdc, const bool kbIdrFlag);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,10 +57,10 @@ namespace WelsEnc {
|
|||||||
extern const uint8_t g_kuiTemporalIdListTable[MAX_TEMPORAL_LEVEL][MAX_GOP_SIZE + 1];
|
extern const uint8_t g_kuiTemporalIdListTable[MAX_TEMPORAL_LEVEL][MAX_GOP_SIZE + 1];
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief get Logarithms base 2 of (upper/base)
|
* \brief get Logarithms base 2 of (upper/base)
|
||||||
* \param base based scaler
|
* \param base based scaler
|
||||||
* \param upper input upper value
|
* \param upper input upper value
|
||||||
* \return 2 based scaling factor
|
* \return 2 based scaling factor
|
||||||
*/
|
*/
|
||||||
static inline uint32_t GetLogFactor (float base, float upper) {
|
static inline uint32_t GetLogFactor (float base, float upper) {
|
||||||
const double dLog2factor = log10 (1.0 * upper / base) / log10 (2.0);
|
const double dLog2factor = log10 (1.0 * upper / base) / log10 (2.0);
|
||||||
@@ -74,7 +74,7 @@ static inline uint32_t GetLogFactor (float base, float upper) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dependency Layer Parameter
|
* Dependency Layer Parameter
|
||||||
*/
|
*/
|
||||||
typedef struct TagDLayerParam {
|
typedef struct TagDLayerParam {
|
||||||
int32_t iActualWidth; // input source picture actual width
|
int32_t iActualWidth; // input source picture actual width
|
||||||
@@ -93,7 +93,7 @@ typedef struct TagDLayerParam {
|
|||||||
} SSpatialLayerInternal;
|
} SSpatialLayerInternal;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cisco OpenH264 Encoder Parameter Configuration
|
* Cisco OpenH264 Encoder Parameter Configuration
|
||||||
*/
|
*/
|
||||||
typedef struct TagWelsSvcCodingParam: SEncParamExt {
|
typedef struct TagWelsSvcCodingParam: SEncParamExt {
|
||||||
SSpatialLayerInternal sDependencyLayers[MAX_DEPENDENCY_LAYER];
|
SSpatialLayerInternal sDependencyLayers[MAX_DEPENDENCY_LAYER];
|
||||||
@@ -432,9 +432,9 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief determined key coding tables for temporal scalability, uiProfileIdc etc for each spatial layer settings
|
* \brief determined key coding tables for temporal scalability, uiProfileIdc etc for each spatial layer settings
|
||||||
* \param SWelsSvcCodingParam, and carried with known GOP size, max, input and output frame rate of each spatial
|
* \param SWelsSvcCodingParam, and carried with known GOP size, max, input and output frame rate of each spatial
|
||||||
* \return NONE (should ensure valid parameter before this procedure)
|
* \return NONE (should ensure valid parameter before this procedure)
|
||||||
*/
|
*/
|
||||||
int32_t DetermineTemporalSettings() {
|
int32_t DetermineTemporalSettings() {
|
||||||
const int32_t iDecStages = WELS_LOG2 (
|
const int32_t iDecStages = WELS_LOG2 (
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ int32_t iFrameAverageQp;
|
|||||||
SScreenBlockFeatureStorage* pScreenBlockFeatureStorage;
|
SScreenBlockFeatureStorage* pScreenBlockFeatureStorage;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* set picture as unreferenced
|
* set picture as unreferenced
|
||||||
*/
|
*/
|
||||||
void SetUnref () {
|
void SetUnref () {
|
||||||
iFramePoc = -1;
|
iFramePoc = -1;
|
||||||
|
|||||||
@@ -45,20 +45,20 @@
|
|||||||
|
|
||||||
namespace WelsEnc {
|
namespace WelsEnc {
|
||||||
/*!
|
/*!
|
||||||
* \brief alloc picture pData with borders for each plane based width and height of picture
|
* \brief alloc picture pData with borders for each plane based width and height of picture
|
||||||
* \param kiWidth width of picture in pixels
|
* \param kiWidth width of picture in pixels
|
||||||
* \param kiHeight height of picture in pixels
|
* \param kiHeight height of picture in pixels
|
||||||
* \param bNeedMbInfo need pData allocation
|
* \param bNeedMbInfo need pData allocation
|
||||||
* \pram iNeedFeatureStorage need storage for FME
|
* \pram iNeedFeatureStorage need storage for FME
|
||||||
* \return successful if effective picture pointer returned, otherwise failed with NULL
|
* \return successful if effective picture pointer returned, otherwise failed with NULL
|
||||||
*/
|
*/
|
||||||
SPicture* AllocPicture (CMemoryAlign* pMa, const int32_t kiWidth, const int32_t kiHeight, bool bNeedMbInfo,
|
SPicture* AllocPicture (CMemoryAlign* pMa, const int32_t kiWidth, const int32_t kiHeight, bool bNeedMbInfo,
|
||||||
int32_t iNeedFeatureStorage);
|
int32_t iNeedFeatureStorage);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief free picture pData planes
|
* \brief free picture pData planes
|
||||||
* \param pic picture pointer to be destoryed
|
* \param pic picture pointer to be destoryed
|
||||||
* \return none
|
* \return none
|
||||||
*/
|
*/
|
||||||
void FreePicture (CMemoryAlign* pMa, SPicture** ppPic);
|
void FreePicture (CMemoryAlign* pMa, SPicture** ppPic);
|
||||||
|
|
||||||
|
|||||||
@@ -46,34 +46,34 @@ namespace WelsEnc {
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief get code name
|
* \brief get code name
|
||||||
* \param pBuf pBuffer to restore code name
|
* \param pBuf pBuffer to restore code name
|
||||||
* \param iSize size of pBuffer overall
|
* \param iSize size of pBuffer overall
|
||||||
* \return actual size of pBuffer used; 0 returned in failure
|
* \return actual size of pBuffer used; 0 returned in failure
|
||||||
*/
|
*/
|
||||||
int32_t GetCodeName (char* pBuf, int32_t iSize);
|
int32_t GetCodeName (char* pBuf, int32_t iSize);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief get library/module name
|
* \brief get library/module name
|
||||||
* \param pBuf pBuffer to restore module name
|
* \param pBuf pBuffer to restore module name
|
||||||
* \param iSize size of pBuffer overall
|
* \param iSize size of pBuffer overall
|
||||||
* \return actual size of pBuffer used; 0 returned in failure
|
* \return actual size of pBuffer used; 0 returned in failure
|
||||||
*/
|
*/
|
||||||
int32_t GetLibName (char* pBuf, int32_t iSize);
|
int32_t GetLibName (char* pBuf, int32_t iSize);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief get version number
|
* \brief get version number
|
||||||
* \param pBuf pBuffer to restore version number
|
* \param pBuf pBuffer to restore version number
|
||||||
* \param iSize size of pBuffer overall
|
* \param iSize size of pBuffer overall
|
||||||
* \return actual size of pBuffer used; 0 returned in failure
|
* \return actual size of pBuffer used; 0 returned in failure
|
||||||
*/
|
*/
|
||||||
int32_t GetVerNum (char* pBuf, int32_t iSize);
|
int32_t GetVerNum (char* pBuf, int32_t iSize);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief get identify information
|
* \brief get identify information
|
||||||
* \param pBuf pBuffer to restore indentify information
|
* \param pBuf pBuffer to restore indentify information
|
||||||
* \param iSize size of pBuffer overall
|
* \param iSize size of pBuffer overall
|
||||||
* \return actual size of pBuffer used; 0 returned in failure
|
* \return actual size of pBuffer used; 0 returned in failure
|
||||||
*/
|
*/
|
||||||
int32_t GetIdentInfo (char* pBuf, int32_t iSize);
|
int32_t GetIdentInfo (char* pBuf, int32_t iSize);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ enum {
|
|||||||
//qp information
|
//qp information
|
||||||
GOM_MIN_QP_MODE = 12,
|
GOM_MIN_QP_MODE = 12,
|
||||||
GOM_MAX_QP_MODE = 36,
|
GOM_MAX_QP_MODE = 36,
|
||||||
MAX_LOW_BR_QP = 42,
|
MAX_LOW_BR_QP = 42,
|
||||||
MIN_IDR_QP = 26,
|
MIN_IDR_QP = 26,
|
||||||
MAX_IDR_QP = 32,
|
MAX_IDR_QP = 32,
|
||||||
MIN_SCREEN_QP = 26,
|
MIN_SCREEN_QP = 26,
|
||||||
|
|||||||
@@ -61,25 +61,25 @@ FRAME_NUM_OVER_MAX = 0x08
|
|||||||
} COMPARE_FRAME_NUM;
|
} COMPARE_FRAME_NUM;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* reset LTR marking , recovery ,feedback state to default
|
* reset LTR marking , recovery ,feedback state to default
|
||||||
*/
|
*/
|
||||||
void ResetLtrState (SLTRState* pLtr);
|
void ResetLtrState (SLTRState* pLtr);
|
||||||
/*
|
/*
|
||||||
* reset reference picture list
|
* reset reference picture list
|
||||||
*/
|
*/
|
||||||
void WelsResetRefList (sWelsEncCtx* pCtx);
|
void WelsResetRefList (sWelsEncCtx* pCtx);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* update reference picture list
|
* update reference picture list
|
||||||
*/
|
*/
|
||||||
bool WelsUpdateRefList (sWelsEncCtx* pCtx);
|
bool WelsUpdateRefList (sWelsEncCtx* pCtx);
|
||||||
/*
|
/*
|
||||||
* build reference picture list
|
* build reference picture list
|
||||||
*/
|
*/
|
||||||
bool WelsBuildRefList (sWelsEncCtx* pCtx, const int32_t kiPOC, int32_t iBestLtrRefIdx);
|
bool WelsBuildRefList (sWelsEncCtx* pCtx, const int32_t kiPOC, int32_t iBestLtrRefIdx);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* update syntax for reference base related
|
* update syntax for reference base related
|
||||||
*/
|
*/
|
||||||
void WelsUpdateRefSyntax (sWelsEncCtx* pCtx, const int32_t kiPOC, const int32_t kiFrameType);
|
void WelsUpdateRefSyntax (sWelsEncCtx* pCtx, const int32_t kiPOC, const int32_t kiFrameType);
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ void WelsUpdateRefSyntax (sWelsEncCtx* pCtx, const int32_t kiPOC, const int32_t
|
|||||||
*/
|
*/
|
||||||
bool CheckCurMarkFrameNumUsed (sWelsEncCtx* pCtx);
|
bool CheckCurMarkFrameNumUsed (sWelsEncCtx* pCtx);
|
||||||
/*
|
/*
|
||||||
* decide whether current frame include long term reference mark and update long term reference mark syntax
|
* decide whether current frame include long term reference mark and update long term reference mark syntax
|
||||||
*/
|
*/
|
||||||
void WelsMarkPic (sWelsEncCtx* pCtx);
|
void WelsMarkPic (sWelsEncCtx* pCtx);
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace WelsEnc {
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reference picture list reordering syntax, refer to page 64 in JVT X201wcm
|
* Reference picture list reordering syntax, refer to page 64 in JVT X201wcm
|
||||||
*/
|
*/
|
||||||
typedef struct TagRefPicListReorderSyntax {
|
typedef struct TagRefPicListReorderSyntax {
|
||||||
struct {
|
struct {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
namespace WelsEnc {
|
namespace WelsEnc {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Stat quality
|
* Stat quality
|
||||||
*/
|
*/
|
||||||
typedef struct TagStatQuality {
|
typedef struct TagStatQuality {
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ float rVPsnr[5];
|
|||||||
} SStatQuality;
|
} SStatQuality;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Stat complexity pData
|
* Stat complexity pData
|
||||||
*/
|
*/
|
||||||
typedef struct TagComplexityStat {
|
typedef struct TagComplexityStat {
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ int32_t mvb_time;
|
|||||||
} SComplexityStat;
|
} SComplexityStat;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Stat slice details information
|
* Stat slice details information
|
||||||
*/
|
*/
|
||||||
typedef struct TagStatSliceInfo {
|
typedef struct TagStatSliceInfo {
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ int32_t iMbCount [5][18];
|
|||||||
} SStatSliceInfo;
|
} SStatSliceInfo;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For overall statistical pData
|
* For overall statistical pData
|
||||||
*/
|
*/
|
||||||
typedef struct TagStatData {
|
typedef struct TagStatData {
|
||||||
|
|
||||||
|
|||||||
@@ -47,8 +47,8 @@
|
|||||||
namespace WelsEnc {
|
namespace WelsEnc {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Frame level in SVC DQLayer instead.
|
* Frame level in SVC DQLayer instead.
|
||||||
* Dependency-Quaility layer struction definition for SVC extension of H.264/AVC
|
* Dependency-Quaility layer struction definition for SVC extension of H.264/AVC
|
||||||
*/
|
*/
|
||||||
|
|
||||||
///////////////////////////////////DQ Layer level///////////////////////////////////
|
///////////////////////////////////DQ Layer level///////////////////////////////////
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace WelsEnc {
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get size of unsigned exp golomb codes
|
* Get size of unsigned exp golomb codes
|
||||||
*/
|
*/
|
||||||
static inline uint32_t BsSizeUE (const uint32_t kiValue) {
|
static inline uint32_t BsSizeUE (const uint32_t kiValue) {
|
||||||
if (256 > kiValue) {
|
if (256 > kiValue) {
|
||||||
@@ -79,7 +79,7 @@ if (256 > kiValue) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get size of signed exp golomb codes
|
* Get size of signed exp golomb codes
|
||||||
*/
|
*/
|
||||||
static inline uint32_t BsSizeSE (const int32_t kiValue) {
|
static inline uint32_t BsSizeSE (const int32_t kiValue) {
|
||||||
uint32_t iTmpValue;
|
uint32_t iTmpValue;
|
||||||
@@ -95,7 +95,7 @@ if (0 == kiValue) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write truncated exp golomb codes
|
* Write truncated exp golomb codes
|
||||||
*/
|
*/
|
||||||
static inline void BsWriteTE (SBitStringAux* pBs, const int32_t kiX, const uint32_t kuiValue) {
|
static inline void BsWriteTE (SBitStringAux* pBs, const int32_t kiX, const uint32_t kuiValue) {
|
||||||
if (1 == kiX) {
|
if (1 == kiX) {
|
||||||
|
|||||||
@@ -58,22 +58,22 @@ namespace WelsEnc {
|
|||||||
// in case MT and PACKING_ONE_SLICE_PER_LAYER, MAX_SLICES_NUM should not be exceeding MAX_LAYER_NUM_OF_FRAME
|
// in case MT and PACKING_ONE_SLICE_PER_LAYER, MAX_SLICES_NUM should not be exceeding MAX_LAYER_NUM_OF_FRAME
|
||||||
// for AVC cases, maximal resolution we can support up to (?x1024) for SM_ROWMB_SLICE slice mode
|
// for AVC cases, maximal resolution we can support up to (?x1024) for SM_ROWMB_SLICE slice mode
|
||||||
// fine solution for MAX_SLICES_NUM, need us use the variable instead of MACRO for any resolution combining any multiple-slice mode adaptive
|
// fine solution for MAX_SLICES_NUM, need us use the variable instead of MACRO for any resolution combining any multiple-slice mode adaptive
|
||||||
#define SAVED_NALUNIT_NUM ( (MAX_SPATIAL_LAYER_NUM*MAX_QUALITY_LAYER_NUM) + 1 + MAX_SPATIAL_LAYER_NUM ) // SPS/PPS + SEI/SSEI + PADDING_NAL
|
#define SAVED_NALUNIT_NUM ( (MAX_SPATIAL_LAYER_NUM*MAX_QUALITY_LAYER_NUM) + 1 + MAX_SPATIAL_LAYER_NUM ) // SPS/PPS + SEI/SSEI + PADDING_NAL
|
||||||
#define MAX_SLICES_NUM ( ( MAX_NAL_UNITS_IN_LAYER - SAVED_NALUNIT_NUM ) / 3 ) // Also MAX_SLICES_NUM need constrained by implementation: uiSliceIdc allocated in SSliceCtx.pOverallMbMap need a byte range as expected
|
#define MAX_SLICES_NUM ( ( MAX_NAL_UNITS_IN_LAYER - SAVED_NALUNIT_NUM ) / 3 ) // Also MAX_SLICES_NUM need constrained by implementation: uiSliceIdc allocated in SSliceCtx.pOverallMbMap need a byte range as expected
|
||||||
#define AVERSLICENUM_CONSTRAINT (MAX_SLICES_NUM) // used in sNalList initialization,
|
#define AVERSLICENUM_CONSTRAINT (MAX_SLICES_NUM) // used in sNalList initialization,
|
||||||
|
|
||||||
#define MIN_NUM_MB_PER_SLICE 48 // (128/16 * 96/16), addressing the lowest resolution for multiple slicing is 128x96 above
|
#define MIN_NUM_MB_PER_SLICE 48 // (128/16 * 96/16), addressing the lowest resolution for multiple slicing is 128x96 above
|
||||||
|
|
||||||
#define DEFAULT_MAXPACKETSIZE_CONSTRAINT (1200) //in bytes
|
#define DEFAULT_MAXPACKETSIZE_CONSTRAINT (1200) //in bytes
|
||||||
//#define MINPACKETSIZE_CONSTRAINT (1200)
|
//#define MINPACKETSIZE_CONSTRAINT (1200)
|
||||||
|
|
||||||
#define AVER_MARGIN_BYTES ( 100 ) //in bytes
|
#define AVER_MARGIN_BYTES ( 100 ) //in bytes
|
||||||
#define JUMPPACKETSIZE_CONSTRAINT(max_byte) ( max_byte - AVER_MARGIN_BYTES ) //in bytes
|
#define JUMPPACKETSIZE_CONSTRAINT(max_byte) ( max_byte - AVER_MARGIN_BYTES ) //in bytes
|
||||||
#define JUMPPACKETSIZE_JUDGE(len,mb_idx,max_byte) ( (len) > JUMPPACKETSIZE_CONSTRAINT(max_byte) ) //( (mb_idx+1)%40/*16slice for compare*/ == 0 ) //
|
#define JUMPPACKETSIZE_JUDGE(len,mb_idx,max_byte) ( (len) > JUMPPACKETSIZE_CONSTRAINT(max_byte) ) //( (mb_idx+1)%40/*16slice for compare*/ == 0 ) //
|
||||||
//cur_mb_idx is for early tests, can be omit in optimization
|
//cur_mb_idx is for early tests, can be omit in optimization
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief SSlice context
|
* \brief SSlice context
|
||||||
*/
|
*/
|
||||||
/* Single/multiple slices */
|
/* Single/multiple slices */
|
||||||
typedef struct SlicepEncCtx_s {
|
typedef struct SlicepEncCtx_s {
|
||||||
@@ -104,17 +104,17 @@ uint8_t uiLastMbQp;
|
|||||||
} SDynamicSlicingStack;
|
} SDynamicSlicingStack;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Initialize Wels SSlice context (Single/multiple slices and FMO)
|
* \brief Initialize Wels SSlice context (Single/multiple slices and FMO)
|
||||||
*
|
*
|
||||||
* \param pSliceCtx SSlice context to be initialized
|
* \param pSliceCtx SSlice context to be initialized
|
||||||
* \param bFmoUseFlag flag of using fmo
|
* \param bFmoUseFlag flag of using fmo
|
||||||
* \param iMbWidth MB width
|
* \param iMbWidth MB width
|
||||||
* \param iMbHeight MB height
|
* \param iMbHeight MB height
|
||||||
* \param uiSliceMode slice mode
|
* \param uiSliceMode slice mode
|
||||||
* \param mul_slice_arg argument for multiple slice if it is applicable
|
* \param mul_slice_arg argument for multiple slice if it is applicable
|
||||||
* \param pPpsArg argument for pPps parameter
|
* \param pPpsArg argument for pPps parameter
|
||||||
*
|
*
|
||||||
* \return 0 - successful; none 0 - failed;
|
* \return 0 - successful; none 0 - failed;
|
||||||
*/
|
*/
|
||||||
int32_t InitSlicePEncCtx (SSliceCtx* pSliceCtx,
|
int32_t InitSlicePEncCtx (SSliceCtx* pSliceCtx,
|
||||||
CMemoryAlign* pMa,
|
CMemoryAlign* pMa,
|
||||||
@@ -126,66 +126,66 @@ int32_t InitSlicePEncCtx (SSliceCtx* pSliceCtx,
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Uninitialize Wels SSlice context (Single/multiple slices and FMO)
|
* \brief Uninitialize Wels SSlice context (Single/multiple slices and FMO)
|
||||||
*
|
*
|
||||||
* \param pSliceCtx SSlice context to be initialized
|
* \param pSliceCtx SSlice context to be initialized
|
||||||
*
|
*
|
||||||
* \return NONE;
|
* \return NONE;
|
||||||
*/
|
*/
|
||||||
void UninitSlicePEncCtx (SSliceCtx* pSliceCtx, CMemoryAlign* pMa);
|
void UninitSlicePEncCtx (SSliceCtx* pSliceCtx, CMemoryAlign* pMa);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get slice idc for given iMbXY (apply in Single/multiple slices and FMO)
|
* \brief Get slice idc for given iMbXY (apply in Single/multiple slices and FMO)
|
||||||
*
|
*
|
||||||
* \param pSliceCtx SSlice context
|
* \param pSliceCtx SSlice context
|
||||||
* \param kiMbXY MB xy index
|
* \param kiMbXY MB xy index
|
||||||
*
|
*
|
||||||
* \return uiSliceIdc - successful; (uint8_t)(-1) - failed;
|
* \return uiSliceIdc - successful; (uint8_t)(-1) - failed;
|
||||||
*/
|
*/
|
||||||
uint16_t WelsMbToSliceIdc (SSliceCtx* pSliceCtx, const int32_t kiMbXY);
|
uint16_t WelsMbToSliceIdc (SSliceCtx* pSliceCtx, const int32_t kiMbXY);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get first mb in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
|
* \brief Get first mb in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
|
||||||
*
|
*
|
||||||
* \param pSliceCtx SSlice context
|
* \param pSliceCtx SSlice context
|
||||||
* \param kiSliceIdc slice idc
|
* \param kiSliceIdc slice idc
|
||||||
*
|
*
|
||||||
* \return first_mb - successful; -1 - failed;
|
* \return first_mb - successful; -1 - failed;
|
||||||
*/
|
*/
|
||||||
int32_t WelsGetFirstMbOfSlice (SSliceCtx* pSliceCtx, const int32_t kiSliceIdc);
|
int32_t WelsGetFirstMbOfSlice (SSliceCtx* pSliceCtx, const int32_t kiSliceIdc);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get successive mb to be processed in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
|
* \brief Get successive mb to be processed in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
|
||||||
*
|
*
|
||||||
* \param pSliceCtx SSlice context
|
* \param pSliceCtx SSlice context
|
||||||
* \param kiMbXY MB xy index
|
* \param kiMbXY MB xy index
|
||||||
*
|
*
|
||||||
* \return next_mb - successful; -1 - failed;
|
* \return next_mb - successful; -1 - failed;
|
||||||
*/
|
*/
|
||||||
int32_t WelsGetNextMbOfSlice (SSliceCtx* pSliceCtx, const int32_t kiMbXY);
|
int32_t WelsGetNextMbOfSlice (SSliceCtx* pSliceCtx, const int32_t kiMbXY);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get previous mb to be processed in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
|
* \brief Get previous mb to be processed in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
|
||||||
*
|
*
|
||||||
* \param pSliceCtx SSlice context
|
* \param pSliceCtx SSlice context
|
||||||
* \param kiMbXY MB xy index
|
* \param kiMbXY MB xy index
|
||||||
*
|
*
|
||||||
* \return prev_mb - successful; -1 - failed;
|
* \return prev_mb - successful; -1 - failed;
|
||||||
*/
|
*/
|
||||||
int32_t WelsGetPrevMbOfSlice (SSliceCtx* pSliceCtx, const int32_t kiMbXY);
|
int32_t WelsGetPrevMbOfSlice (SSliceCtx* pSliceCtx, const int32_t kiMbXY);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get number of mb in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
|
* \brief Get number of mb in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
|
||||||
*
|
*
|
||||||
* \param pSliceCtx SSlice context
|
* \param pSliceCtx SSlice context
|
||||||
* \param kiSliceIdc slice/slice_group idc
|
* \param kiSliceIdc slice/slice_group idc
|
||||||
*
|
*
|
||||||
* \return count_num_of_mb - successful; -1 - failed;
|
* \return count_num_of_mb - successful; -1 - failed;
|
||||||
*/
|
*/
|
||||||
int32_t WelsGetNumMbInSlice (SSliceCtx* pSliceCtx, const int32_t kiSliceIdc);
|
int32_t WelsGetNumMbInSlice (SSliceCtx* pSliceCtx, const int32_t kiSliceIdc);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get slice count for multiple slice segment
|
* Get slice count for multiple slice segment
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int32_t GetInitialSliceNum (const int32_t kiMbWidth, const int32_t kiMbHeight, SSliceConfig* pMso);
|
int32_t GetInitialSliceNum (const int32_t kiMbWidth, const int32_t kiMbHeight, SSliceConfig* pMso);
|
||||||
|
|||||||
@@ -112,46 +112,46 @@ typedef struct TagCropOffset {
|
|||||||
/* Transform Type */
|
/* Transform Type */
|
||||||
|
|
||||||
enum ETransType {
|
enum ETransType {
|
||||||
T_4x4 = 0,
|
T_4x4 = 0,
|
||||||
T_8x8 = 1,
|
T_8x8 = 1,
|
||||||
T_16x16 = 2,
|
T_16x16 = 2,
|
||||||
T_PCM = 3
|
T_PCM = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EMbPosition {
|
enum EMbPosition {
|
||||||
LEFT_MB_POS = 0x01, // A
|
LEFT_MB_POS = 0x01, // A
|
||||||
TOP_MB_POS = 0x02, // B
|
TOP_MB_POS = 0x02, // B
|
||||||
TOPRIGHT_MB_POS = 0x04, // C
|
TOPRIGHT_MB_POS = 0x04, // C
|
||||||
TOPLEFT_MB_POS = 0x08, // D,
|
TOPLEFT_MB_POS = 0x08, // D,
|
||||||
RIGHT_MB_POS = 0x10, // add followed four case to reuse when intra up-sample
|
RIGHT_MB_POS = 0x10, // add followed four case to reuse when intra up-sample
|
||||||
BOTTOM_MB_POS = 0x20, //
|
BOTTOM_MB_POS = 0x20, //
|
||||||
BOTTOMRIGHT_MB_POS = 0x40, //
|
BOTTOMRIGHT_MB_POS = 0x40, //
|
||||||
BOTTOMLEFT_MB_POS = 0x80, //
|
BOTTOMLEFT_MB_POS = 0x80, //
|
||||||
MB_POS_A = 0x100
|
MB_POS_A = 0x100
|
||||||
};
|
};
|
||||||
|
|
||||||
/* MB Type & Sub-MB Type */
|
/* MB Type & Sub-MB Type */
|
||||||
typedef uint32_t Mb_Type;
|
typedef uint32_t Mb_Type;
|
||||||
|
|
||||||
#define MB_LEFT_BIT 0// add to use in intra up-sample
|
#define MB_LEFT_BIT 0// add to use in intra up-sample
|
||||||
#define MB_TOP_BIT 1
|
#define MB_TOP_BIT 1
|
||||||
#define MB_TOPRIGHT_BIT 2
|
#define MB_TOPRIGHT_BIT 2
|
||||||
#define MB_TOPLEFT_BIT 3
|
#define MB_TOPLEFT_BIT 3
|
||||||
#define MB_RIGHT_BIT 4
|
#define MB_RIGHT_BIT 4
|
||||||
#define MB_BOTTOM_BIT 5
|
#define MB_BOTTOM_BIT 5
|
||||||
#define MB_BTMRIGHT_BIT 6
|
#define MB_BTMRIGHT_BIT 6
|
||||||
#define MB_BTMLEFT_BIT 7
|
#define MB_BTMLEFT_BIT 7
|
||||||
|
|
||||||
#define MB_TYPE_BACKGROUND 0x00010000 // conditional BG skip_mb
|
#define MB_TYPE_BACKGROUND 0x00010000 // conditional BG skip_mb
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
Intra4x4 = 0,
|
Intra4x4 = 0,
|
||||||
Intra16x16 = 1,
|
Intra16x16 = 1,
|
||||||
Inter16x16 = 2,
|
Inter16x16 = 2,
|
||||||
Inter16x8 = 3,
|
Inter16x8 = 3,
|
||||||
Inter8x16 = 4,
|
Inter8x16 = 4,
|
||||||
Inter8x8 = 5,
|
Inter8x8 = 5,
|
||||||
PSkip = 6
|
PSkip = 6
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,105 +45,105 @@
|
|||||||
|
|
||||||
#define STATISTICS_LOG_INTERVAL_MS (5000) // output statistics log every 5s
|
#define STATISTICS_LOG_INTERVAL_MS (5000) // output statistics log every 5s
|
||||||
|
|
||||||
#define INTRA_4x4_MODE_NUM 8
|
#define INTRA_4x4_MODE_NUM 8
|
||||||
#define MB_LUMA_CHROMA_BLOCK4x4_NUM 24
|
#define MB_LUMA_CHROMA_BLOCK4x4_NUM 24
|
||||||
|
|
||||||
#define MAX_PPS_COUNT_LIMITED 57// limit the max ID of PPS because of known limitation of receiver endpoints
|
#define MAX_PPS_COUNT_LIMITED 57// limit the max ID of PPS because of known limitation of receiver endpoints
|
||||||
#define MAX_PPS_COUNT (MAX_PPS_COUNT_LIMITED)//in Standard is 256 // Count number of PPS
|
#define MAX_PPS_COUNT (MAX_PPS_COUNT_LIMITED)//in Standard is 256 // Count number of PPS
|
||||||
|
|
||||||
#define PARA_SET_TYPE 3 // SPS+PPS
|
#define PARA_SET_TYPE 3 // SPS+PPS
|
||||||
#define PARA_SET_TYPE_AVCSPS 0
|
#define PARA_SET_TYPE_AVCSPS 0
|
||||||
#define PARA_SET_TYPE_SUBSETSPS 1
|
#define PARA_SET_TYPE_SUBSETSPS 1
|
||||||
#define PARA_SET_TYPE_PPS 2
|
#define PARA_SET_TYPE_PPS 2
|
||||||
|
|
||||||
#define MAX_VERTICAL_MV_RANGE 1024 //TODO, for allocate enough memory for transpose
|
#define MAX_VERTICAL_MV_RANGE 1024 //TODO, for allocate enough memory for transpose
|
||||||
#define MAX_FRAME_RATE 60 // maximal frame rate to support
|
#define MAX_FRAME_RATE 60 // maximal frame rate to support
|
||||||
#define MIN_FRAME_RATE 1 // minimal frame rate need support
|
#define MIN_FRAME_RATE 1 // minimal frame rate need support
|
||||||
|
|
||||||
#define MAX_BIT_RATE INT_MAX // maximal bit rate to support
|
#define MAX_BIT_RATE INT_MAX // maximal bit rate to support
|
||||||
//TODO {Sijia}: 30fps*MaxCPB in level5.1 = 30*240000*1000bits = 7 200 000 000, larger than INT_MAX which is 2147483647, but this is also very big and abnormal number, should figure out a reasonable number after discussion
|
//TODO {Sijia}: 30fps*MaxCPB in level5.1 = 30*240000*1000bits = 7 200 000 000, larger than INT_MAX which is 2147483647, but this is also very big and abnormal number, should figure out a reasonable number after discussion
|
||||||
#define MIN_BIT_RATE 1 // minimal bit rate need support
|
#define MIN_BIT_RATE 1 // minimal bit rate need support
|
||||||
|
|
||||||
#define SVC_QUALITY_BASE_QP 26
|
#define SVC_QUALITY_BASE_QP 26
|
||||||
#define MAX_SLICEGROUP_IDS 8 // Count number of SSlice Groups
|
#define MAX_SLICEGROUP_IDS 8 // Count number of SSlice Groups
|
||||||
#define MAX_THREADS_NUM 4 // assume to support up to 4 logical cores(threads)
|
#define MAX_THREADS_NUM 4 // assume to support up to 4 logical cores(threads)
|
||||||
|
|
||||||
#define INTPEL_NEEDED_MARGIN (3) // for safe sub-pel MC
|
#define INTPEL_NEEDED_MARGIN (3) // for safe sub-pel MC
|
||||||
|
|
||||||
#define I420_PLANES 3
|
#define I420_PLANES 3
|
||||||
|
|
||||||
#define COMPRESS_RATIO_THR (1.0f) //set to size of the original data, which will be large enough considering MinCR
|
#define COMPRESS_RATIO_THR (1.0f) //set to size of the original data, which will be large enough considering MinCR
|
||||||
|
|
||||||
#if !defined(SSEI_BUFFER_SIZE)
|
#if !defined(SSEI_BUFFER_SIZE)
|
||||||
#define SSEI_BUFFER_SIZE 128
|
#define SSEI_BUFFER_SIZE 128
|
||||||
#endif//SSEI_BUFFER_SIZE
|
#endif//SSEI_BUFFER_SIZE
|
||||||
|
|
||||||
#if !defined(SPS_BUFFER_SIZE)
|
#if !defined(SPS_BUFFER_SIZE)
|
||||||
#define SPS_BUFFER_SIZE 32
|
#define SPS_BUFFER_SIZE 32
|
||||||
#endif//SPS_BUFFER_SIZE
|
#endif//SPS_BUFFER_SIZE
|
||||||
|
|
||||||
#if !defined(PPS_BUFFER_SIZE)
|
#if !defined(PPS_BUFFER_SIZE)
|
||||||
#define PPS_BUFFER_SIZE 16
|
#define PPS_BUFFER_SIZE 16
|
||||||
#endif//PPS_BUFFER_SIZE
|
#endif//PPS_BUFFER_SIZE
|
||||||
|
|
||||||
#if !defined(MAX_MACROBLOCK_SIZE_IN_BYTE)
|
#if !defined(MAX_MACROBLOCK_SIZE_IN_BYTE)
|
||||||
#define MAX_MACROBLOCK_SIZE_IN_BYTE 400 //3200/8, 3200 is from Annex A.3.1.(n)
|
#define MAX_MACROBLOCK_SIZE_IN_BYTE 400 //3200/8, 3200 is from Annex A.3.1.(n)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_MACROBLOCK_SIZE_IN_BYTE_x2 (MAX_MACROBLOCK_SIZE_IN_BYTE<<1)
|
#define MAX_MACROBLOCK_SIZE_IN_BYTE_x2 (MAX_MACROBLOCK_SIZE_IN_BYTE<<1)
|
||||||
|
|
||||||
#if defined(NUM_SPATIAL_LAYERS_CONSTRAINT)
|
#if defined(NUM_SPATIAL_LAYERS_CONSTRAINT)
|
||||||
#define MAX_DEPENDENCY_LAYER MAX_SPATIAL_LAYER_NUM // Maximal dependency layer
|
#define MAX_DEPENDENCY_LAYER MAX_SPATIAL_LAYER_NUM // Maximal dependency layer
|
||||||
#else
|
#else
|
||||||
#define MAX_DEPENDENCY_LAYER 8 // Maximal dependency layer
|
#define MAX_DEPENDENCY_LAYER 8 // Maximal dependency layer
|
||||||
#endif//NUM_SPATIAL_LAYERS_CONSTRAINT
|
#endif//NUM_SPATIAL_LAYERS_CONSTRAINT
|
||||||
|
|
||||||
//The max temporal level support is equal or less than MAX_TEMPORAL_LAYER_NUM defined @ codec_app_def.h
|
//The max temporal level support is equal or less than MAX_TEMPORAL_LAYER_NUM defined @ codec_app_def.h
|
||||||
#define MAX_TEMPORAL_LEVEL MAX_TEMPORAL_LAYER_NUM // Maximal temporal level
|
#define MAX_TEMPORAL_LEVEL MAX_TEMPORAL_LAYER_NUM // Maximal temporal level
|
||||||
|
|
||||||
#if defined(NUM_QUALITY_LAYERS_CONSTRAINT)
|
#if defined(NUM_QUALITY_LAYERS_CONSTRAINT)
|
||||||
#define MAX_QUALITY_LEVEL MAX_QUALITY_LAYER_NUM // Maximal quality level
|
#define MAX_QUALITY_LEVEL MAX_QUALITY_LAYER_NUM // Maximal quality level
|
||||||
#else
|
#else
|
||||||
#define MAX_QUALITY_LEVEL 16 // Maximal quality level
|
#define MAX_QUALITY_LEVEL 16 // Maximal quality level
|
||||||
#endif//NUM_QUALITY_LAYERS_CONSTRAINT
|
#endif//NUM_QUALITY_LAYERS_CONSTRAINT
|
||||||
|
|
||||||
#if defined(MAX_GOP_SIZE)
|
#if defined(MAX_GOP_SIZE)
|
||||||
#undef MAX_GOP_SIZE
|
#undef MAX_GOP_SIZE
|
||||||
#endif//MAX_GOP_SIZE
|
#endif//MAX_GOP_SIZE
|
||||||
#define MAX_GOP_SIZE (1<<(MAX_TEMPORAL_LEVEL-1))
|
#define MAX_GOP_SIZE (1<<(MAX_TEMPORAL_LEVEL-1))
|
||||||
|
|
||||||
#define MAX_SHORT_REF_COUNT (MAX_GOP_SIZE>>1) // 16 in standard, maximal count number of short reference pictures
|
#define MAX_SHORT_REF_COUNT (MAX_GOP_SIZE>>1) // 16 in standard, maximal count number of short reference pictures
|
||||||
#define LONG_TERM_REF_NUM 2
|
#define LONG_TERM_REF_NUM 2
|
||||||
#define LONG_TERM_REF_NUM_SCREEN 4
|
#define LONG_TERM_REF_NUM_SCREEN 4
|
||||||
#define MAX_REF_PIC_COUNT 16 // 32 in standard, maximal Short + Long reference pictures
|
#define MAX_REF_PIC_COUNT 16 // 32 in standard, maximal Short + Long reference pictures
|
||||||
#define MIN_REF_PIC_COUNT 1 // minimal count number of reference pictures, 1 short + 2 key reference based?
|
#define MIN_REF_PIC_COUNT 1 // minimal count number of reference pictures, 1 short + 2 key reference based?
|
||||||
#define MAX_MULTI_REF_PIC_COUNT 1 //maximum multi-reference number
|
#define MAX_MULTI_REF_PIC_COUNT 1 //maximum multi-reference number
|
||||||
//#define TOTAL_REF_MINUS_HALF_GOP 1 // last t0 in last gop
|
//#define TOTAL_REF_MINUS_HALF_GOP 1 // last t0 in last gop
|
||||||
#define MAX_MMCO_COUNT 66
|
#define MAX_MMCO_COUNT 66
|
||||||
|
|
||||||
// adjusted numbers reference picture functionality related definition
|
// adjusted numbers reference picture functionality related definition
|
||||||
#define MAX_REFERENCE_MMCO_COUNT_NUM 4 // adjusted MAX_MMCO_COUNT(66 in standard) definition per encoder design
|
#define MAX_REFERENCE_MMCO_COUNT_NUM 4 // adjusted MAX_MMCO_COUNT(66 in standard) definition per encoder design
|
||||||
#define MAX_REFERENCE_REORDER_COUNT_NUM 2 // adjusted MAX_REF_PIC_COUNT(32 in standard) for reference reordering definition per encoder design
|
#define MAX_REFERENCE_REORDER_COUNT_NUM 2 // adjusted MAX_REF_PIC_COUNT(32 in standard) for reference reordering definition per encoder design
|
||||||
#define MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA (MAX_SHORT_REF_COUNT+LONG_TERM_REF_NUM) // <= MAX_REF_PIC_COUNT, memory saved if <
|
#define MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA (MAX_SHORT_REF_COUNT+LONG_TERM_REF_NUM) // <= MAX_REF_PIC_COUNT, memory saved if <
|
||||||
#define MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN (MAX_SHORT_REF_COUNT+LONG_TERM_REF_NUM_SCREEN) // <= MAX_REF_PIC_COUNT, memory saved if <
|
#define MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN (MAX_SHORT_REF_COUNT+LONG_TERM_REF_NUM_SCREEN) // <= MAX_REF_PIC_COUNT, memory saved if <
|
||||||
|
|
||||||
#define BASE_DEPENDENCY_ID 0
|
#define BASE_DEPENDENCY_ID 0
|
||||||
#define MAX_DQ_LAYER_NUM (MAX_DEPENDENCY_LAYER/**MAX_QUALITY_LEVEL*/)
|
#define MAX_DQ_LAYER_NUM (MAX_DEPENDENCY_LAYER/**MAX_QUALITY_LEVEL*/)
|
||||||
|
|
||||||
#define INVALID_ID (-1)
|
#define INVALID_ID (-1)
|
||||||
|
|
||||||
#define NAL_HEADER_ADD_0X30BYTES 50
|
#define NAL_HEADER_ADD_0X30BYTES 50
|
||||||
|
|
||||||
#define SLICE_NUM_EXPAND_COEF 2
|
#define SLICE_NUM_EXPAND_COEF 2
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
BLOCK_16x16 = 0,
|
BLOCK_16x16 = 0,
|
||||||
BLOCK_16x8 = 1,
|
BLOCK_16x8 = 1,
|
||||||
BLOCK_8x16 = 2,
|
BLOCK_8x16 = 2,
|
||||||
BLOCK_8x8 = 3,
|
BLOCK_8x8 = 3,
|
||||||
BLOCK_4x4 = 4,
|
BLOCK_4x4 = 4,
|
||||||
// BLOCK_8x4 = 5,
|
// BLOCK_8x4 = 5,
|
||||||
// BLOCK_4x8 = 6,
|
// BLOCK_4x8 = 6,
|
||||||
BLOCK_SIZE_ALL = 5
|
BLOCK_SIZE_ALL = 5
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -154,8 +154,8 @@ RECIEVE_FAILED = 2
|
|||||||
} LTR_MARKING_RECEIVE_STATE;
|
} LTR_MARKING_RECEIVE_STATE;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
CUR_AU_IDX = 0, // index symbol for current access unit
|
CUR_AU_IDX = 0, // index symbol for current access unit
|
||||||
SUC_AU_IDX = 1 // index symbol for successive access unit
|
SUC_AU_IDX = 1 // index symbol for successive access unit
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|||||||
@@ -185,10 +185,10 @@ class CWelsPreProcess {
|
|||||||
void SaveBestRefToVaa (SRefInfoParam& sRefSaved, SRefInfoParam* pVaaBestRef);
|
void SaveBestRefToVaa (SRefInfoParam& sRefSaved, SRefInfoParam* pVaaBestRef);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief exchange two picture pData planes
|
* \brief exchange two picture pData planes
|
||||||
* \param ppPic1 picture pointer to picture 1
|
* \param ppPic1 picture pointer to picture 1
|
||||||
* \param ppPic2 picture pointer to picture 2
|
* \param ppPic2 picture pointer to picture 2
|
||||||
* \return none
|
* \return none
|
||||||
*/
|
*/
|
||||||
void WelsExchangeSpatialPictures (SPicture** ppPic1, SPicture** ppPic2);
|
void WelsExchangeSpatialPictures (SPicture** ppPic1, SPicture** ppPic2);
|
||||||
|
|
||||||
|
|||||||
@@ -225,15 +225,15 @@ int32_t WelsWriteVUI (SWelsSPS* pSps, SBitStringAux* pBitStringAux) {
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief to set Sequence Parameter Set (SPS)
|
* \brief to set Sequence Parameter Set (SPS)
|
||||||
*
|
*
|
||||||
* \param pSps SWelsSPS to be wrote, update iSpsId dependency
|
* \param pSps SWelsSPS to be wrote, update iSpsId dependency
|
||||||
* \param pBitStringAux bitstream writer auxiliary
|
* \param pBitStringAux bitstream writer auxiliary
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* 1 - failed
|
* 1 - failed
|
||||||
*
|
*
|
||||||
* \note Call it in case EWelsNalUnitType is SPS.
|
* \note Call it in case EWelsNalUnitType is SPS.
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t WelsWriteSpsSyntax (SWelsSPS* pSps, SBitStringAux* pBitStringAux, int32_t* pSpsIdDelta, bool bBaseLayer) {
|
int32_t WelsWriteSpsSyntax (SWelsSPS* pSps, SBitStringAux* pBitStringAux, int32_t* pSpsIdDelta, bool bBaseLayer) {
|
||||||
@@ -300,15 +300,15 @@ int32_t WelsWriteSpsNal (SWelsSPS* pSps, SBitStringAux* pBitStringAux, int32_t*
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief to write SubSet Sequence Parameter Set
|
* \brief to write SubSet Sequence Parameter Set
|
||||||
*
|
*
|
||||||
* \param sub_sps subset pSps parsed
|
* \param sub_sps subset pSps parsed
|
||||||
* \param pBitStringAux bitstream writer auxiliary
|
* \param pBitStringAux bitstream writer auxiliary
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* 1 - failed
|
* 1 - failed
|
||||||
*
|
*
|
||||||
* \note Call it in case EWelsNalUnitType is SubSet SPS.
|
* \note Call it in case EWelsNalUnitType is SubSet SPS.
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -349,15 +349,15 @@ int32_t WelsWriteSubsetSpsSyntax (SSubsetSps* pSubsetSps, SBitStringAux* pBitStr
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief to write Picture Parameter Set (PPS)
|
* \brief to write Picture Parameter Set (PPS)
|
||||||
*
|
*
|
||||||
* \param pPps pPps
|
* \param pPps pPps
|
||||||
* \param pBitStringAux bitstream writer auxiliary
|
* \param pBitStringAux bitstream writer auxiliary
|
||||||
*
|
*
|
||||||
* \return 0 - successed
|
* \return 0 - successed
|
||||||
* 1 - failed
|
* 1 - failed
|
||||||
*
|
*
|
||||||
* \note Call it in case EWelsNalUnitType is PPS.
|
* \note Call it in case EWelsNalUnitType is PPS.
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t WelsWritePpsSyntax (SWelsPPS* pPps, SBitStringAux* pBitStringAux, SParaSetOffset* pPSOVector) {
|
int32_t WelsWritePpsSyntax (SWelsPPS* pPps, SBitStringAux* pBitStringAux, SParaSetOffset* pPSOVector) {
|
||||||
|
|||||||
@@ -61,12 +61,12 @@ namespace WelsEnc {
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief initialize source picture body
|
* \brief initialize source picture body
|
||||||
* \param pSrc SSourcePicture*
|
* \param pSrc SSourcePicture*
|
||||||
* \param csp internal csp format
|
* \param csp internal csp format
|
||||||
* \param iWidth widht of picture in pixels
|
* \param iWidth widht of picture in pixels
|
||||||
* \param iHeight iHeight of picture in pixels
|
* \param iHeight iHeight of picture in pixels
|
||||||
* \return successful - 0; otherwise none 0 for failed
|
* \return successful - 0; otherwise none 0 for failed
|
||||||
*/
|
*/
|
||||||
int32_t InitPic (const void* kpSrc, const int32_t kiColorspace, const int32_t kiWidth, const int32_t kiHeight) {
|
int32_t InitPic (const void* kpSrc, const int32_t kiColorspace, const int32_t kiWidth, const int32_t kiHeight) {
|
||||||
SSourcePicture* pSrcPic = (SSourcePicture*)kpSrc;
|
SSourcePicture* pSrcPic = (SSourcePicture*)kpSrc;
|
||||||
@@ -149,9 +149,9 @@ void WelsInitBGDFunc (SWelsFuncPtrList* pFuncList, const bool kbEnableBackground
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief initialize function pointers that potentially used in Wels encoding
|
* \brief initialize function pointers that potentially used in Wels encoding
|
||||||
* \param pEncCtx sWelsEncCtx*
|
* \param pEncCtx sWelsEncCtx*
|
||||||
* \return successful - 0; otherwise none 0 for failed
|
* \return successful - 0; otherwise none 0 for failed
|
||||||
*/
|
*/
|
||||||
int32_t InitFunctionPointers (sWelsEncCtx* pEncCtx, SWelsSvcCodingParam* pParam, uint32_t uiCpuFlag) {
|
int32_t InitFunctionPointers (sWelsEncCtx* pEncCtx, SWelsSvcCodingParam* pParam, uint32_t uiCpuFlag) {
|
||||||
int32_t iReturn = ENC_RETURN_SUCCESS;
|
int32_t iReturn = ENC_RETURN_SUCCESS;
|
||||||
@@ -227,7 +227,7 @@ int32_t InitFunctionPointers (sWelsEncCtx* pEncCtx, SWelsSvcCodingParam* pParam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief initialize frame coding
|
* \brief initialize frame coding
|
||||||
*/
|
*/
|
||||||
void InitFrameCoding (sWelsEncCtx* pEncCtx, const EVideoFrameType keFrameType) {
|
void InitFrameCoding (sWelsEncCtx* pEncCtx, const EVideoFrameType keFrameType) {
|
||||||
// for bitstream writing
|
// for bitstream writing
|
||||||
@@ -364,7 +364,7 @@ EVideoFrameType DecideFrameType (sWelsEncCtx* pEncCtx, const int8_t kiSpatialNum
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Dump reconstruction for dependency layer
|
* \brief Dump reconstruction for dependency layer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid, bool bAppend,
|
extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid, bool bAppend,
|
||||||
@@ -432,7 +432,7 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Dump the reconstruction pictures
|
* \brief Dump the reconstruction pictures
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid, bool bAppend,
|
void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid, bool bAppend,
|
||||||
|
|||||||
@@ -166,9 +166,9 @@ void CheckReferenceNumSetting (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
* \brief validate checking in parameter configuration
|
* \brief validate checking in parameter configuration
|
||||||
* \pParam pParam SWelsSvcCodingParam*
|
* \pParam pParam SWelsSvcCodingParam*
|
||||||
* \return successful - 0; otherwise none 0 for failed
|
* \return successful - 0; otherwise none 0 for failed
|
||||||
*/
|
*/
|
||||||
int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) {
|
int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) {
|
||||||
const float fEpsn = 0.000001f;
|
const float fEpsn = 0.000001f;
|
||||||
@@ -654,12 +654,12 @@ int32_t WelsEncoderApplyBitVaryRang (SLogContext* pLogCtx, SWelsSvcCodingParam*
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief acquire count number of layers and NALs based on configurable paramters dependency
|
* \brief acquire count number of layers and NALs based on configurable paramters dependency
|
||||||
* \pParam pCtx sWelsEncCtx*
|
* \pParam pCtx sWelsEncCtx*
|
||||||
* \pParam pParam SWelsSvcCodingParam*
|
* \pParam pParam SWelsSvcCodingParam*
|
||||||
* \pParam pCountLayers pointer of count number of layers indeed
|
* \pParam pCountLayers pointer of count number of layers indeed
|
||||||
* \pParam iCountNals pointer of count number of nals indeed
|
* \pParam iCountNals pointer of count number of nals indeed
|
||||||
* \return 0 - successful; otherwise failed
|
* \return 0 - successful; otherwise failed
|
||||||
*/
|
*/
|
||||||
static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pParam, int32_t* pCountLayers,
|
static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pParam, int32_t* pCountLayers,
|
||||||
int32_t* pCountNals) {
|
int32_t* pCountNals) {
|
||||||
@@ -1054,9 +1054,9 @@ int32_t FindExistingPps (SWelsSPS* pSps, SSubsetSps* pSubsetSps, const bool kbUs
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief initialize ppDqLayerList and slicepEncCtx_list due to count number of layers available
|
* \brief initialize ppDqLayerList and slicepEncCtx_list due to count number of layers available
|
||||||
* \pParam pCtx sWelsEncCtx*
|
* \pParam pCtx sWelsEncCtx*
|
||||||
* \return 0 - successful; otherwise failed
|
* \return 0 - successful; otherwise failed
|
||||||
*/
|
*/
|
||||||
static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingParasetList) {
|
static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingParasetList) {
|
||||||
SWelsSvcCodingParam* pParam = NULL;
|
SWelsSvcCodingParam* pParam = NULL;
|
||||||
@@ -1671,9 +1671,9 @@ void ReleaseMemoryVaaScreen (SVAAFrameInfo* pVaa, CMemoryAlign* pMa, const int3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
* \brief request specific memory for SVC
|
* \brief request specific memory for SVC
|
||||||
* \pParam pEncCtx sWelsEncCtx*
|
* \pParam pEncCtx sWelsEncCtx*
|
||||||
* \return successful - 0; otherwise none 0 for failed
|
* \return successful - 0; otherwise none 0 for failed
|
||||||
*/
|
*/
|
||||||
void GetMvMvdRange (SWelsSvcCodingParam* pParam, int32_t& iMvRange, int32_t& iMvdRange) {
|
void GetMvMvdRange (SWelsSvcCodingParam* pParam, int32_t& iMvRange, int32_t& iMvdRange) {
|
||||||
ELevelIdc iMinLevelIdc = LEVEL_5_2;
|
ELevelIdc iMinLevelIdc = LEVEL_5_2;
|
||||||
@@ -1941,9 +1941,9 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief free memory in SVC core encoder
|
* \brief free memory in SVC core encoder
|
||||||
* \pParam pEncCtx sWelsEncCtx*
|
* \pParam pEncCtx sWelsEncCtx*
|
||||||
* \return none
|
* \return none
|
||||||
*/
|
*/
|
||||||
void FreeMemorySvc (sWelsEncCtx** ppCtx) {
|
void FreeMemorySvc (sWelsEncCtx** ppCtx) {
|
||||||
if (NULL != *ppCtx) {
|
if (NULL != *ppCtx) {
|
||||||
@@ -2316,7 +2316,7 @@ int32_t InitSliceSettings (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPar
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief log output for cpu features/capabilities
|
* \brief log output for cpu features/capabilities
|
||||||
*/
|
*/
|
||||||
void OutputCpuFeaturesLog (SLogContext* pLogCtx, uint32_t uiCpuFeatureFlags, uint32_t uiCpuCores,
|
void OutputCpuFeaturesLog (SLogContext* pLogCtx, uint32_t uiCpuFeatureFlags, uint32_t uiCpuCores,
|
||||||
int32_t iCacheLineSize) {
|
int32_t iCacheLineSize) {
|
||||||
@@ -2412,10 +2412,10 @@ int32_t GetMultipleThreadIdc (SLogContext* pLogCtx, SWelsSvcCodingParam* pCoding
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief initialize Wels avc encoder core library
|
* \brief initialize Wels avc encoder core library
|
||||||
* \pParam ppCtx sWelsEncCtx**
|
* \pParam ppCtx sWelsEncCtx**
|
||||||
* \pParam pParam SWelsSvcCodingParam*
|
* \pParam pParam SWelsSvcCodingParam*
|
||||||
* \return successful - 0; otherwise none 0 for failed
|
* \return successful - 0; otherwise none 0 for failed
|
||||||
*/
|
*/
|
||||||
int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingParam, SLogContext* pLogCtx,
|
int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingParam, SLogContext* pLogCtx,
|
||||||
SExistingParasetList* pExistingParasetList) {
|
SExistingParasetList* pExistingParasetList) {
|
||||||
@@ -2605,9 +2605,9 @@ void StatOverallEncodingExt (sWelsEncCtx* pCtx) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/*!
|
/*!
|
||||||
* \brief uninitialize Wels encoder core library
|
* \brief uninitialize Wels encoder core library
|
||||||
* \pParam pEncCtx sWelsEncCtx*
|
* \pParam pEncCtx sWelsEncCtx*
|
||||||
* \return none
|
* \return none
|
||||||
*/
|
*/
|
||||||
void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) {
|
void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) {
|
||||||
if (NULL == ppCtx || NULL == *ppCtx)
|
if (NULL == ppCtx || NULL == *ppCtx)
|
||||||
@@ -2650,7 +2650,7 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief get temporal level due to configuration and coding context
|
* \brief get temporal level due to configuration and coding context
|
||||||
*/
|
*/
|
||||||
int32_t GetTemporalLevel (SSpatialLayerInternal* fDlp, const int32_t kiFrameNum, const int32_t kiGopSize) {
|
int32_t GetTemporalLevel (SSpatialLayerInternal* fDlp, const int32_t kiFrameNum, const int32_t kiGopSize) {
|
||||||
const int32_t kiCodingIdx = kiFrameNum & (kiGopSize - 1);
|
const int32_t kiCodingIdx = kiFrameNum & (kiGopSize - 1);
|
||||||
@@ -2810,7 +2810,7 @@ void WelsInitCurrentDlayerMltslc (sWelsEncCtx* pCtx, int32_t iPartitionNum) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief initialize current layer
|
* \brief initialize current layer
|
||||||
*/
|
*/
|
||||||
void WelsInitCurrentLayer (sWelsEncCtx* pCtx,
|
void WelsInitCurrentLayer (sWelsEncCtx* pCtx,
|
||||||
const int32_t kiWidth,
|
const int32_t kiWidth,
|
||||||
@@ -3072,7 +3072,7 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief swap pDq layers between current pDq layer and reference pDq layer
|
* \brief swap pDq layers between current pDq layer and reference pDq layer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static inline void WelsSwapDqLayers (sWelsEncCtx* pCtx) {
|
static inline void WelsSwapDqLayers (sWelsEncCtx* pCtx) {
|
||||||
@@ -3087,7 +3087,7 @@ static inline void WelsSwapDqLayers (sWelsEncCtx* pCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief prefetch reference picture after WelsBuildRefList
|
* \brief prefetch reference picture after WelsBuildRefList
|
||||||
*/
|
*/
|
||||||
static inline void PrefetchReferencePicture (sWelsEncCtx* pCtx, const EVideoFrameType keFrameType) {
|
static inline void PrefetchReferencePicture (sWelsEncCtx* pCtx, const EVideoFrameType keFrameType) {
|
||||||
SSlice* pSliceBase = &pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[0];
|
SSlice* pSliceBase = &pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[0];
|
||||||
@@ -3208,8 +3208,8 @@ void UpdatePpsList (sWelsEncCtx* pCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief write all parameter sets introduced in SVC extension
|
* \brief write all parameter sets introduced in SVC extension
|
||||||
* \return writing results, success or error
|
* \return writing results, success or error
|
||||||
*/
|
*/
|
||||||
int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pNumNal, int32_t* pTotalLength) {
|
int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pNumNal, int32_t* pTotalLength) {
|
||||||
int32_t iSize = 0;
|
int32_t iSize = 0;
|
||||||
@@ -3652,12 +3652,12 @@ int32_t WriteSavcParaset_Listing (sWelsEncCtx* pCtx, const int32_t kiSpatialNum,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief core svc encoding process
|
* \brief core svc encoding process
|
||||||
*
|
*
|
||||||
* \pParam pCtx sWelsEncCtx*, encoder context
|
* \pParam pCtx sWelsEncCtx*, encoder context
|
||||||
* \pParam pFbi FrameBSInfo*
|
* \pParam pFbi FrameBSInfo*
|
||||||
* \pParam pSrcPic Source Picture
|
* \pParam pSrcPic Source Picture
|
||||||
* \return EFrameType (videoFrameTypeIDR/videoFrameTypeI/videoFrameTypeP)
|
* \return EFrameType (videoFrameTypeIDR/videoFrameTypeI/videoFrameTypeP)
|
||||||
*/
|
*/
|
||||||
int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSourcePicture* pSrcPic) {
|
int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSourcePicture* pSrcPic) {
|
||||||
if (pCtx == NULL) {
|
if (pCtx == NULL) {
|
||||||
@@ -4364,8 +4364,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Wels SVC encoder parameters adjustment
|
* \brief Wels SVC encoder parameters adjustment
|
||||||
* SVC adjustment results in new requirement in memory blocks adjustment
|
* SVC adjustment results in new requirement in memory blocks adjustment
|
||||||
*/
|
*/
|
||||||
int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewParam) {
|
int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewParam) {
|
||||||
SWelsSvcCodingParam* pOldParam = NULL;
|
SWelsSvcCodingParam* pOldParam = NULL;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
#include "ls_defines.h"
|
#include "ls_defines.h"
|
||||||
namespace WelsEnc {
|
namespace WelsEnc {
|
||||||
/*!
|
/*!
|
||||||
* \brief load an initialize NAL pRawNal pData
|
* \brief load an initialize NAL pRawNal pData
|
||||||
*/
|
*/
|
||||||
void WelsLoadNal (SWelsEncoderOutput* pEncoderOuput, const int32_t/*EWelsNalUnitType*/ kiType,
|
void WelsLoadNal (SWelsEncoderOutput* pEncoderOuput, const int32_t/*EWelsNalUnitType*/ kiType,
|
||||||
const int32_t/*EWelsNalRefIdc*/ kiNalRefIdc) {
|
const int32_t/*EWelsNalRefIdc*/ kiNalRefIdc) {
|
||||||
@@ -60,7 +60,7 @@ void WelsLoadNal (SWelsEncoderOutput* pEncoderOuput, const int32_t/*EWelsNalUnit
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief unload pRawNal NAL
|
* \brief unload pRawNal NAL
|
||||||
*/
|
*/
|
||||||
void WelsUnloadNal (SWelsEncoderOutput* pEncoderOuput) {
|
void WelsUnloadNal (SWelsEncoderOutput* pEncoderOuput) {
|
||||||
SWelsEncoderOutput* pWelsEncoderOuput = pEncoderOuput;
|
SWelsEncoderOutput* pWelsEncoderOuput = pEncoderOuput;
|
||||||
@@ -75,7 +75,7 @@ void WelsUnloadNal (SWelsEncoderOutput* pEncoderOuput) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief load an initialize NAL pRawNal pData
|
* \brief load an initialize NAL pRawNal pData
|
||||||
*/
|
*/
|
||||||
void WelsLoadNalForSlice (SWelsSliceBs* pSliceBsIn, const int32_t/*EWelsNalUnitType*/ kiType,
|
void WelsLoadNalForSlice (SWelsSliceBs* pSliceBsIn, const int32_t/*EWelsNalUnitType*/ kiType,
|
||||||
const int32_t/*EWelsNalRefIdc*/ kiNalRefIdc) {
|
const int32_t/*EWelsNalRefIdc*/ kiNalRefIdc) {
|
||||||
@@ -95,7 +95,7 @@ void WelsLoadNalForSlice (SWelsSliceBs* pSliceBsIn, const int32_t/*EWelsNalUnitT
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief unload pRawNal NAL
|
* \brief unload pRawNal NAL
|
||||||
*/
|
*/
|
||||||
void WelsUnloadNalForSlice (SWelsSliceBs* pSliceBsIn) {
|
void WelsUnloadNalForSlice (SWelsSliceBs* pSliceBsIn) {
|
||||||
SWelsSliceBs* pSliceBs = pSliceBsIn;
|
SWelsSliceBs* pSliceBs = pSliceBsIn;
|
||||||
@@ -111,12 +111,12 @@ void WelsUnloadNalForSlice (SWelsSliceBs* pSliceBsIn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief encode NAL with emulation forbidden three bytes checking
|
* \brief encode NAL with emulation forbidden three bytes checking
|
||||||
* \param pDst pDst NAL pData
|
* \param pDst pDst NAL pData
|
||||||
* \param pDstLen length of pDst NAL output
|
* \param pDstLen length of pDst NAL output
|
||||||
* \param annexeb annexeb flag
|
* \param annexeb annexeb flag
|
||||||
* \param pRawNal pRawNal NAL pData
|
* \param pRawNal pRawNal NAL pData
|
||||||
* \return ERRCODE
|
* \return ERRCODE
|
||||||
*/
|
*/
|
||||||
//TODO 1: refactor the calling of this func in multi-thread
|
//TODO 1: refactor the calling of this func in multi-thread
|
||||||
//TODO 2: complete the realloc©
|
//TODO 2: complete the realloc©
|
||||||
@@ -186,7 +186,7 @@ int32_t WelsEncodeNal (SWelsNalRaw* pRawNal, void* pNalHeaderExt, const int32_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief write prefix nal
|
* \brief write prefix nal
|
||||||
*/
|
*/
|
||||||
int32_t WelsWriteSVCPrefixNal (SBitStringAux* pBitStringAux, const int32_t kiNalRefIdc,
|
int32_t WelsWriteSVCPrefixNal (SBitStringAux* pBitStringAux, const int32_t kiNalRefIdc,
|
||||||
const bool kbIdrFlag) {
|
const bool kbIdrFlag) {
|
||||||
|
|||||||
@@ -41,12 +41,12 @@
|
|||||||
|
|
||||||
namespace WelsEnc {
|
namespace WelsEnc {
|
||||||
/*!
|
/*!
|
||||||
* \brief alloc picture pData with borders for each plane based width and height of picture
|
* \brief alloc picture pData with borders for each plane based width and height of picture
|
||||||
* \param cx width of picture in pixels
|
* \param cx width of picture in pixels
|
||||||
* \param cy height of picture in pixels
|
* \param cy height of picture in pixels
|
||||||
* \param need_data need pData allocation
|
* \param need_data need pData allocation
|
||||||
* \pram need_expand need borders expanding
|
* \pram need_expand need borders expanding
|
||||||
* \return successful if effective picture pointer returned, otherwise failed with NULL
|
* \return successful if effective picture pointer returned, otherwise failed with NULL
|
||||||
*/
|
*/
|
||||||
SPicture* AllocPicture (CMemoryAlign* pMa, const int32_t kiWidth , const int32_t kiHeight,
|
SPicture* AllocPicture (CMemoryAlign* pMa, const int32_t kiWidth , const int32_t kiHeight,
|
||||||
bool bNeedMbInfo, int32_t iNeedFeatureStorage) {
|
bool bNeedMbInfo, int32_t iNeedFeatureStorage) {
|
||||||
@@ -122,9 +122,9 @@ SPicture* AllocPicture (CMemoryAlign* pMa, const int32_t kiWidth , const int32_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief free picture pData planes
|
* \brief free picture pData planes
|
||||||
* \param pPic picture pointer to be destoryed
|
* \param pPic picture pointer to be destoryed
|
||||||
* \return none
|
* \return none
|
||||||
*/
|
*/
|
||||||
void FreePicture (CMemoryAlign* pMa, SPicture** ppPic) {
|
void FreePicture (CMemoryAlign* pMa, SPicture** ppPic) {
|
||||||
if (NULL != ppPic && NULL != *ppPic) {
|
if (NULL != ppPic && NULL != *ppPic) {
|
||||||
|
|||||||
@@ -40,23 +40,23 @@
|
|||||||
#include "property.h"
|
#include "property.h"
|
||||||
#include "crt_util_safe_x.h" // Safe CRT routines like utils for cross_platforms
|
#include "crt_util_safe_x.h" // Safe CRT routines like utils for cross_platforms
|
||||||
namespace WelsEnc {
|
namespace WelsEnc {
|
||||||
#define WELS_CODE_NAME "Wels"
|
#define WELS_CODE_NAME "Wels"
|
||||||
#define WELS_LIB_NAME "Encoder"
|
#define WELS_LIB_NAME "Encoder"
|
||||||
|
|
||||||
#define WELS_VERSION_INT 0x000001 // v 0.0.1
|
#define WELS_VERSION_INT 0x000001 // v 0.0.1
|
||||||
#define WELS_VERSION_STR "0.0.1"
|
#define WELS_VERSION_STR "0.0.1"
|
||||||
|
|
||||||
#define WELS_BUILD_NUM "090420" // yymmdd
|
#define WELS_BUILD_NUM "090420" // yymmdd
|
||||||
|
|
||||||
//////////////summary information//////////////
|
//////////////summary information//////////////
|
||||||
|
|
||||||
#define WELS_IDENT WELS_CODE_NAME WELS_LIB_NAME "v" WELS_VERSION_STR "b" WELS_BUILD_NUM
|
#define WELS_IDENT WELS_CODE_NAME WELS_LIB_NAME "v" WELS_VERSION_STR "b" WELS_BUILD_NUM
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief get code name
|
* \brief get code name
|
||||||
* \param pBuf pBuffer to restore code name
|
* \param pBuf pBuffer to restore code name
|
||||||
* \param iSize size of pBuffer overall
|
* \param iSize size of pBuffer overall
|
||||||
* \return actual size of pBuffer used; 0 returned in failure
|
* \return actual size of pBuffer used; 0 returned in failure
|
||||||
*/
|
*/
|
||||||
int32_t GetCodeName (char* pBuf, int32_t iSize) {
|
int32_t GetCodeName (char* pBuf, int32_t iSize) {
|
||||||
int32_t iLen = 0;
|
int32_t iLen = 0;
|
||||||
@@ -74,10 +74,10 @@ int32_t GetCodeName (char* pBuf, int32_t iSize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief get library/module name
|
* \brief get library/module name
|
||||||
* \param pBuf pBuffer to restore module name
|
* \param pBuf pBuffer to restore module name
|
||||||
* \param iSize size of pBuffer overall
|
* \param iSize size of pBuffer overall
|
||||||
* \return actual size of pBuffer used; 0 returned in failure
|
* \return actual size of pBuffer used; 0 returned in failure
|
||||||
*/
|
*/
|
||||||
int32_t GetLibName (char* pBuf, int32_t iSize) {
|
int32_t GetLibName (char* pBuf, int32_t iSize) {
|
||||||
int32_t iLen = 0;
|
int32_t iLen = 0;
|
||||||
@@ -95,10 +95,10 @@ int32_t GetLibName (char* pBuf, int32_t iSize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief get version number
|
* \brief get version number
|
||||||
* \param pBuf pBuffer to restore version number
|
* \param pBuf pBuffer to restore version number
|
||||||
* \param iSize size of pBuffer overall
|
* \param iSize size of pBuffer overall
|
||||||
* \return actual size of pBuffer used; 0 returned in failure
|
* \return actual size of pBuffer used; 0 returned in failure
|
||||||
*/
|
*/
|
||||||
int32_t GetVerNum (char* pBuf, int32_t iSize) {
|
int32_t GetVerNum (char* pBuf, int32_t iSize) {
|
||||||
int32_t iLen = 0;
|
int32_t iLen = 0;
|
||||||
@@ -116,10 +116,10 @@ int32_t GetVerNum (char* pBuf, int32_t iSize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief get identify information
|
* \brief get identify information
|
||||||
* \param pBuf pBuffer to restore indentify information
|
* \param pBuf pBuffer to restore indentify information
|
||||||
* \param iSize size of pBuffer overall
|
* \param iSize size of pBuffer overall
|
||||||
* \return actual size of pBuffer used; 0 returned in failure
|
* \return actual size of pBuffer used; 0 returned in failure
|
||||||
*/
|
*/
|
||||||
int32_t GetIdentInfo (char* pBuf, int32_t iSize) {
|
int32_t GetIdentInfo (char* pBuf, int32_t iSize) {
|
||||||
int32_t iLen = 0;
|
int32_t iLen = 0;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
namespace WelsEnc {
|
namespace WelsEnc {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* reset LTR marking , recovery ,feedback state to default
|
* reset LTR marking , recovery ,feedback state to default
|
||||||
*/
|
*/
|
||||||
void ResetLtrState (SLTRState* pLtr) {
|
void ResetLtrState (SLTRState* pLtr) {
|
||||||
pLtr->bReceivedT0LostFlag = false;
|
pLtr->bReceivedT0LostFlag = false;
|
||||||
@@ -60,7 +60,7 @@ void ResetLtrState (SLTRState* pLtr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* reset reference picture list
|
* reset reference picture list
|
||||||
*/
|
*/
|
||||||
void WelsResetRefList (sWelsEncCtx* pCtx) {
|
void WelsResetRefList (sWelsEncCtx* pCtx) {
|
||||||
SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
|
SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
|
||||||
@@ -146,7 +146,7 @@ static inline int32_t CompareFrameNum (int32_t iFrameNumA, int32_t iFrameNumB, i
|
|||||||
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* delete failed mark according LTR recovery pRequest
|
* delete failed mark according LTR recovery pRequest
|
||||||
*/
|
*/
|
||||||
static inline void DeleteInvalidLTR (sWelsEncCtx* pCtx) {
|
static inline void DeleteInvalidLTR (sWelsEncCtx* pCtx) {
|
||||||
SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
|
SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
|
||||||
@@ -188,7 +188,7 @@ static inline void DeleteInvalidLTR (sWelsEncCtx* pCtx) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* handle LTR Mark feedback message
|
* handle LTR Mark feedback message
|
||||||
*/
|
*/
|
||||||
static inline void HandleLTRMarkFeedback (sWelsEncCtx* pCtx) {
|
static inline void HandleLTRMarkFeedback (sWelsEncCtx* pCtx) {
|
||||||
SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
|
SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
|
||||||
@@ -243,7 +243,7 @@ static inline void HandleLTRMarkFeedback (sWelsEncCtx* pCtx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* LTR mark process
|
* LTR mark process
|
||||||
*/
|
*/
|
||||||
static inline void LTRMarkProcess (sWelsEncCtx* pCtx) {
|
static inline void LTRMarkProcess (sWelsEncCtx* pCtx) {
|
||||||
SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
|
SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
|
||||||
@@ -344,7 +344,7 @@ static void PrefetchNextBuffer (sWelsEncCtx* pCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* update reference picture list
|
* update reference picture list
|
||||||
*/
|
*/
|
||||||
bool WelsUpdateRefList (sWelsEncCtx* pCtx) {
|
bool WelsUpdateRefList (sWelsEncCtx* pCtx) {
|
||||||
SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
|
SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
|
||||||
@@ -552,7 +552,7 @@ void FilterLTRMarkingFeedback (sWelsEncCtx* pCtx, SLTRMarkingFeedback* pLTRMarki
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* build reference picture list
|
* build reference picture list
|
||||||
*/
|
*/
|
||||||
bool WelsBuildRefList (sWelsEncCtx* pCtx, const int32_t iPOC, int32_t iBestLtrRefIdx) {
|
bool WelsBuildRefList (sWelsEncCtx* pCtx, const int32_t iPOC, int32_t iBestLtrRefIdx) {
|
||||||
SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
|
SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
|
||||||
@@ -562,9 +562,9 @@ bool WelsBuildRefList (sWelsEncCtx* pCtx, const int32_t iPOC, int32_t iBestLtrRe
|
|||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
|
|
||||||
// to support any type of cur_dq->mgs_control
|
// to support any type of cur_dq->mgs_control
|
||||||
// [ 0: using current layer to do ME/MC;
|
// [ 0: using current layer to do ME/MC;
|
||||||
// -1: using store base layer to do ME/MC;
|
// -1: using store base layer to do ME/MC;
|
||||||
// 2: using highest layer to do ME/MC; ]
|
// 2: using highest layer to do ME/MC; ]
|
||||||
|
|
||||||
// build reference list 0/1 if applicable
|
// build reference list 0/1 if applicable
|
||||||
|
|
||||||
@@ -623,7 +623,7 @@ static void UpdateBlockStatic (sWelsEncCtx* pCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* update syntax for reference base related
|
* update syntax for reference base related
|
||||||
*/
|
*/
|
||||||
void WelsUpdateRefSyntax (sWelsEncCtx* pCtx, const int32_t iPOC, const int32_t uiFrameType) {
|
void WelsUpdateRefSyntax (sWelsEncCtx* pCtx, const int32_t iPOC, const int32_t uiFrameType) {
|
||||||
SLTRState* pLtr = &pCtx->pLtr[pCtx->uiDependencyId];
|
SLTRState* pLtr = &pCtx->pLtr[pCtx->uiDependencyId];
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ const ALIGNED_DECLARE (uint8_t, g_kuiZeroLeftMap[16], 16) = {
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exponential Golomb codes encoding routines
|
* Exponential Golomb codes encoding routines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CAVLC_BS_INIT( pBs ) \
|
#define CAVLC_BS_INIT( pBs ) \
|
||||||
|
|||||||
@@ -42,12 +42,12 @@
|
|||||||
|
|
||||||
namespace WelsEnc {
|
namespace WelsEnc {
|
||||||
/*!
|
/*!
|
||||||
* \brief Assign MB map for single slice segment
|
* \brief Assign MB map for single slice segment
|
||||||
*
|
*
|
||||||
* \param pMbMap overall MB map
|
* \param pMbMap overall MB map
|
||||||
* \param iCountMbNum count number of MB
|
* \param iCountMbNum count number of MB
|
||||||
*
|
*
|
||||||
* \return 0 - successful; none 0 - failed
|
* \return 0 - successful; none 0 - failed
|
||||||
*/
|
*/
|
||||||
int32_t AssignMbMapSingleSlice (void* pMbMap, const int32_t kiCountMbNum, const int32_t kiMapUnitSize) {
|
int32_t AssignMbMapSingleSlice (void* pMbMap, const int32_t kiCountMbNum, const int32_t kiMapUnitSize) {
|
||||||
if (NULL == pMbMap || kiCountMbNum <= 0)
|
if (NULL == pMbMap || kiCountMbNum <= 0)
|
||||||
@@ -59,12 +59,12 @@ int32_t AssignMbMapSingleSlice (void* pMbMap, const int32_t kiCountMbNum, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Assign MB map for multiple slice(s) segment
|
* \brief Assign MB map for multiple slice(s) segment
|
||||||
*
|
*
|
||||||
* \param pMbMap overall MB map
|
* \param pMbMap overall MB map
|
||||||
* \param iCountMbNum count number of MB
|
* \param iCountMbNum count number of MB
|
||||||
*
|
*
|
||||||
* \return 0 - successful; none 0 - failed
|
* \return 0 - successful; none 0 - failed
|
||||||
*/
|
*/
|
||||||
int32_t AssignMbMapMultipleSlices (SSliceCtx* pSliceSeg, const SSliceConfig* kpMso) {
|
int32_t AssignMbMapMultipleSlices (SSliceCtx* pSliceSeg, const SSliceConfig* kpMso) {
|
||||||
if (NULL == pSliceSeg || SM_SINGLE_SLICE == pSliceSeg->uiSliceMode)
|
if (NULL == pSliceSeg || SM_SINGLE_SLICE == pSliceSeg->uiSliceMode)
|
||||||
@@ -315,7 +315,7 @@ bool GomValidCheckSliceMbNum (const int32_t kiMbWidth, const int32_t kiMbHeight,
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get slice count for multiple slice segment
|
* Get slice count for multiple slice segment
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int32_t GetInitialSliceNum (const int32_t kiMbWidth, const int32_t kiMbHeight, SSliceConfig* pMso) {
|
int32_t GetInitialSliceNum (const int32_t kiMbWidth, const int32_t kiMbHeight, SSliceConfig* pMso) {
|
||||||
@@ -343,15 +343,15 @@ int32_t GetInitialSliceNum (const int32_t kiMbWidth, const int32_t kiMbHeight, S
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Initialize slice segment (Single/multiple slices)
|
* \brief Initialize slice segment (Single/multiple slices)
|
||||||
*
|
*
|
||||||
* \param pSliceSeg SSlice segment to be initialized
|
* \param pSliceSeg SSlice segment to be initialized
|
||||||
* \param uiSliceMode SSlice mode
|
* \param uiSliceMode SSlice mode
|
||||||
* \param multi_slice_argv Multiple slices argument
|
* \param multi_slice_argv Multiple slices argument
|
||||||
* \param iMbWidth MB width
|
* \param iMbWidth MB width
|
||||||
* \param iMbHeight MB height
|
* \param iMbHeight MB height
|
||||||
*
|
*
|
||||||
* \return 0 - successful; none 0 - failed;
|
* \return 0 - successful; none 0 - failed;
|
||||||
*/
|
*/
|
||||||
int32_t InitSliceSegment (SSliceCtx* pSliceSeg,
|
int32_t InitSliceSegment (SSliceCtx* pSliceSeg,
|
||||||
CMemoryAlign* pMa,
|
CMemoryAlign* pMa,
|
||||||
@@ -467,11 +467,11 @@ int32_t InitSliceSegment (SSliceCtx* pSliceSeg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Uninitialize slice segment (Single/multiple slices)
|
* \brief Uninitialize slice segment (Single/multiple slices)
|
||||||
*
|
*
|
||||||
* \param pSliceSeg SSlice segment to be uninitialized
|
* \param pSliceSeg SSlice segment to be uninitialized
|
||||||
*
|
*
|
||||||
* \return none;
|
* \return none;
|
||||||
*/
|
*/
|
||||||
void UninitSliceSegment (SSliceCtx* pSliceSeg, CMemoryAlign* pMa) {
|
void UninitSliceSegment (SSliceCtx* pSliceSeg, CMemoryAlign* pMa) {
|
||||||
if (NULL != pSliceSeg) {
|
if (NULL != pSliceSeg) {
|
||||||
@@ -501,17 +501,17 @@ void UninitSliceSegment (SSliceCtx* pSliceSeg, CMemoryAlign* pMa) {
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Initialize Wels SSlice context (Single/multiple slices and FMO)
|
* \brief Initialize Wels SSlice context (Single/multiple slices and FMO)
|
||||||
*
|
*
|
||||||
* \param pSliceCtx SSlice context to be initialized
|
* \param pSliceCtx SSlice context to be initialized
|
||||||
* \param bFmoUseFlag flag of using fmo
|
* \param bFmoUseFlag flag of using fmo
|
||||||
* \param iMbWidth MB width
|
* \param iMbWidth MB width
|
||||||
* \param iMbHeight MB height
|
* \param iMbHeight MB height
|
||||||
* \param uiSliceMode slice mode
|
* \param uiSliceMode slice mode
|
||||||
* \param mul_slice_arg argument for multiple slice if it is applicable
|
* \param mul_slice_arg argument for multiple slice if it is applicable
|
||||||
* \param pPpsArg argument for pPps parameter
|
* \param pPpsArg argument for pPps parameter
|
||||||
*
|
*
|
||||||
* \return 0 - successful; none 0 - failed;
|
* \return 0 - successful; none 0 - failed;
|
||||||
*/
|
*/
|
||||||
int32_t InitSlicePEncCtx (SSliceCtx* pSliceCtx,
|
int32_t InitSlicePEncCtx (SSliceCtx* pSliceCtx,
|
||||||
CMemoryAlign* pMa,
|
CMemoryAlign* pMa,
|
||||||
@@ -532,11 +532,11 @@ int32_t InitSlicePEncCtx (SSliceCtx* pSliceCtx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Uninitialize Wels SSlice context (Single/multiple slices and FMO)
|
* \brief Uninitialize Wels SSlice context (Single/multiple slices and FMO)
|
||||||
*
|
*
|
||||||
* \param pSliceCtx SSlice context to be initialized
|
* \param pSliceCtx SSlice context to be initialized
|
||||||
*
|
*
|
||||||
* \return NONE;
|
* \return NONE;
|
||||||
*/
|
*/
|
||||||
void UninitSlicePEncCtx (SSliceCtx* pSliceCtx, CMemoryAlign* pMa) {
|
void UninitSlicePEncCtx (SSliceCtx* pSliceCtx, CMemoryAlign* pMa) {
|
||||||
if (NULL != pSliceCtx) {
|
if (NULL != pSliceCtx) {
|
||||||
@@ -545,12 +545,12 @@ void UninitSlicePEncCtx (SSliceCtx* pSliceCtx, CMemoryAlign* pMa) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get slice idc for given iMbXY (apply in Single/multiple slices and FMO)
|
* \brief Get slice idc for given iMbXY (apply in Single/multiple slices and FMO)
|
||||||
*
|
*
|
||||||
* \param pSliceCtx SSlice context
|
* \param pSliceCtx SSlice context
|
||||||
* \param kiMbXY MB xy index
|
* \param kiMbXY MB xy index
|
||||||
*
|
*
|
||||||
* \return uiSliceIdc - successful; -1 - failed;
|
* \return uiSliceIdc - successful; -1 - failed;
|
||||||
*/
|
*/
|
||||||
uint16_t WelsMbToSliceIdc (SSliceCtx* pSliceCtx, const int32_t kiMbXY) {
|
uint16_t WelsMbToSliceIdc (SSliceCtx* pSliceCtx, const int32_t kiMbXY) {
|
||||||
if (NULL != pSliceCtx && kiMbXY < pSliceCtx->iMbNumInFrame && kiMbXY >= 0)
|
if (NULL != pSliceCtx && kiMbXY < pSliceCtx->iMbNumInFrame && kiMbXY >= 0)
|
||||||
@@ -559,24 +559,24 @@ uint16_t WelsMbToSliceIdc (SSliceCtx* pSliceCtx, const int32_t kiMbXY) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get first mb in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
|
* \brief Get first mb in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
|
||||||
*
|
*
|
||||||
* \param pSliceCtx SSlice context
|
* \param pSliceCtx SSlice context
|
||||||
* \param kuiSliceIdc slice idc
|
* \param kuiSliceIdc slice idc
|
||||||
*
|
*
|
||||||
* \return iFirstMb - successful; -1 - failed;
|
* \return iFirstMb - successful; -1 - failed;
|
||||||
*/
|
*/
|
||||||
int32_t WelsGetFirstMbOfSlice (SSliceCtx* pSliceCtx, const int32_t kuiSliceIdc) {
|
int32_t WelsGetFirstMbOfSlice (SSliceCtx* pSliceCtx, const int32_t kuiSliceIdc) {
|
||||||
return pSliceCtx->pFirstMbInSlice[ kuiSliceIdc ];
|
return pSliceCtx->pFirstMbInSlice[ kuiSliceIdc ];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get successive mb to be processed in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
|
* \brief Get successive mb to be processed in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
|
||||||
*
|
*
|
||||||
* \param pSliceCtx SSlice context
|
* \param pSliceCtx SSlice context
|
||||||
* \param kiMbXY MB xy index
|
* \param kiMbXY MB xy index
|
||||||
*
|
*
|
||||||
* \return next_mb - successful; -1 - failed;
|
* \return next_mb - successful; -1 - failed;
|
||||||
*/
|
*/
|
||||||
int32_t WelsGetNextMbOfSlice (SSliceCtx* pSliceCtx, const int32_t kiMbXY) {
|
int32_t WelsGetNextMbOfSlice (SSliceCtx* pSliceCtx, const int32_t kiMbXY) {
|
||||||
if (NULL != pSliceCtx) {
|
if (NULL != pSliceCtx) {
|
||||||
@@ -605,12 +605,12 @@ int32_t WelsGetNextMbOfSlice (SSliceCtx* pSliceCtx, const int32_t kiMbXY) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get previous mb to be processed in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
|
* \brief Get previous mb to be processed in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
|
||||||
*
|
*
|
||||||
* \param pSliceCtx SSlice context
|
* \param pSliceCtx SSlice context
|
||||||
* \param kiMbXY MB xy index
|
* \param kiMbXY MB xy index
|
||||||
*
|
*
|
||||||
* \return prev_mb - successful; -1 - failed;
|
* \return prev_mb - successful; -1 - failed;
|
||||||
*/
|
*/
|
||||||
int32_t WelsGetPrevMbOfSlice (SSliceCtx* pSliceCtx, const int32_t kiMbXY) {
|
int32_t WelsGetPrevMbOfSlice (SSliceCtx* pSliceCtx, const int32_t kiMbXY) {
|
||||||
if (NULL != pSliceCtx) {
|
if (NULL != pSliceCtx) {
|
||||||
@@ -635,12 +635,12 @@ int32_t WelsGetPrevMbOfSlice (SSliceCtx* pSliceCtx, const int32_t kiMbXY) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get number of mb in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
|
* \brief Get number of mb in slice/slice_group: uiSliceIdc (apply in Single/multiple slices and FMO)
|
||||||
*
|
*
|
||||||
* \param pSliceCtx SSlice context
|
* \param pSliceCtx SSlice context
|
||||||
* \param kuiSliceIdc slice/slice_group idc
|
* \param kuiSliceIdc slice/slice_group idc
|
||||||
*
|
*
|
||||||
* \return count_num_of_mb - successful; -1 - failed;
|
* \return count_num_of_mb - successful; -1 - failed;
|
||||||
*/
|
*/
|
||||||
int32_t WelsGetNumMbInSlice (SSliceCtx* pSliceCtx, const int32_t kuiSliceIdc) {
|
int32_t WelsGetNumMbInSlice (SSliceCtx* pSliceCtx, const int32_t kuiSliceIdc) {
|
||||||
if (NULL == pSliceCtx || kuiSliceIdc < 0)
|
if (NULL == pSliceCtx || kuiSliceIdc < 0)
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ void WelsCountMbType (int32_t (*iMbCount)[18], const EWelsSliceType keSt, const
|
|||||||
#endif//MB_TYPES_CHECK
|
#endif//MB_TYPES_CHECK
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief write reference picture list on reordering syntax in Slice header
|
* \brief write reference picture list on reordering syntax in Slice header
|
||||||
*/
|
*/
|
||||||
void WriteReferenceReorder (SBitStringAux* pBs, SSliceHeader* sSliceHeader) {
|
void WriteReferenceReorder (SBitStringAux* pBs, SSliceHeader* sSliceHeader) {
|
||||||
SRefPicListReorderSyntax* pRefOrdering = &sSliceHeader->sRefReordering;
|
SRefPicListReorderSyntax* pRefOrdering = &sSliceHeader->sRefReordering;
|
||||||
@@ -201,7 +201,7 @@ void WriteReferenceReorder (SBitStringAux* pBs, SSliceHeader* sSliceHeader) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief write reference picture marking syntax in pSlice header
|
* \brief write reference picture marking syntax in pSlice header
|
||||||
*/
|
*/
|
||||||
void WriteRefPicMarking (SBitStringAux* pBs, SSliceHeader* pSliceHeader, SNalUnitHeaderExt* pNalHdrExt) {
|
void WriteRefPicMarking (SBitStringAux* pBs, SSliceHeader* pSliceHeader, SNalUnitHeaderExt* pNalHdrExt) {
|
||||||
SRefPicMarking* sRefMarking = &pSliceHeader->sRefMarking;
|
SRefPicMarking* sRefMarking = &pSliceHeader->sRefMarking;
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ inline void WelsUpdateSpatialIdxMap (sWelsEncCtx* pEncCtx, int32_t iPos, SPic
|
|||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
*
|
*
|
||||||
* implement of the interface
|
* implement of the interface
|
||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
@@ -285,8 +285,8 @@ int32_t CWelsPreProcess::UpdateSpatialPictures (sWelsEncCtx* pCtx, SWelsSvcCodin
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SingleLayerPreprocess: down sampling if applicable
|
* SingleLayerPreprocess: down sampling if applicable
|
||||||
* @return: exact number of spatial layers need to encoder indeed
|
* @return: exact number of spatial layers need to encoder indeed
|
||||||
*/
|
*/
|
||||||
int32_t CWelsPreProcess::SingleLayerPreprocess (sWelsEncCtx* pCtx, const SSourcePicture* kpSrc,
|
int32_t CWelsPreProcess::SingleLayerPreprocess (sWelsEncCtx* pCtx, const SSourcePicture* kpSrc,
|
||||||
Scaled_Picture* pScaledPicture) {
|
Scaled_Picture* pScaledPicture) {
|
||||||
@@ -405,7 +405,7 @@ int32_t CWelsPreProcess::SingleLayerPreprocess (sWelsEncCtx* pCtx, const SSource
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Whether input picture need be scaled?
|
* \brief Whether input picture need be scaled?
|
||||||
*/
|
*/
|
||||||
bool JudgeNeedOfScaling (SWelsSvcCodingParam* pParam, Scaled_Picture* pScaledPicture) {
|
bool JudgeNeedOfScaling (SWelsSvcCodingParam* pParam, Scaled_Picture* pScaledPicture) {
|
||||||
const int32_t kiInputPicWidth = pParam->SUsedPicRect.iWidth;
|
const int32_t kiInputPicWidth = pParam->SUsedPicRect.iWidth;
|
||||||
@@ -1195,10 +1195,10 @@ int32_t CWelsPreProcess::UpdateBlockIdcForScreen (uint8_t* pCurBlockStaticPoint
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief exchange two picture pData planes
|
* \brief exchange two picture pData planes
|
||||||
* \param ppPic1 picture pointer to picture 1
|
* \param ppPic1 picture pointer to picture 1
|
||||||
* \param ppPic2 picture pointer to picture 2
|
* \param ppPic2 picture pointer to picture 2
|
||||||
* \return none
|
* \return none
|
||||||
*/
|
*/
|
||||||
void CWelsPreProcess::WelsExchangeSpatialPictures (SPicture** ppPic1, SPicture** ppPic2) {
|
void CWelsPreProcess::WelsExchangeSpatialPictures (SPicture** ppPic1, SPicture** ppPic2) {
|
||||||
SPicture* tmp = *ppPic1;
|
SPicture* tmp = *ppPic1;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
namespace WelsEnc {
|
namespace WelsEnc {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CWelsH264SVCEncoder class implementation
|
* CWelsH264SVCEncoder class implementation
|
||||||
*/
|
*/
|
||||||
CWelsH264SVCEncoder::CWelsH264SVCEncoder()
|
CWelsH264SVCEncoder::CWelsH264SVCEncoder()
|
||||||
: m_pEncContext (NULL),
|
: m_pEncContext (NULL),
|
||||||
@@ -178,7 +178,7 @@ int CWelsH264SVCEncoder::GetDefaultParams (SEncParamExt* argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SVC Encoder Initialization
|
* SVC Encoder Initialization
|
||||||
*/
|
*/
|
||||||
int CWelsH264SVCEncoder::Initialize (const SEncParamBase* argv) {
|
int CWelsH264SVCEncoder::Initialize (const SEncParamBase* argv) {
|
||||||
if (m_pWelsTrace == NULL) {
|
if (m_pWelsTrace == NULL) {
|
||||||
@@ -348,7 +348,7 @@ int CWelsH264SVCEncoder::InitializeInternal (SWelsSvcCodingParam* pCfg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SVC Encoder Uninitialization
|
* SVC Encoder Uninitialization
|
||||||
*/
|
*/
|
||||||
int32_t CWelsH264SVCEncoder::Uninitialize() {
|
int32_t CWelsH264SVCEncoder::Uninitialize() {
|
||||||
if (!m_bInitialFlag) {
|
if (!m_bInitialFlag) {
|
||||||
@@ -370,7 +370,7 @@ int32_t CWelsH264SVCEncoder::Uninitialize() {
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SVC core encoding
|
* SVC core encoding
|
||||||
*/
|
*/
|
||||||
int CWelsH264SVCEncoder::EncodeFrame (const SSourcePicture* kpSrcPic, SFrameBSInfo* pBsInfo) {
|
int CWelsH264SVCEncoder::EncodeFrame (const SSourcePicture* kpSrcPic, SFrameBSInfo* pBsInfo) {
|
||||||
if (! (kpSrcPic && m_bInitialFlag && pBsInfo)) {
|
if (! (kpSrcPic && m_bInitialFlag && pBsInfo)) {
|
||||||
@@ -469,7 +469,7 @@ int CWelsH264SVCEncoder::EncodeParameterSets (SFrameBSInfo* pBsInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Force key frame
|
* Force key frame
|
||||||
*/
|
*/
|
||||||
int CWelsH264SVCEncoder::ForceIntraFrame (bool bIDR) {
|
int CWelsH264SVCEncoder::ForceIntraFrame (bool bIDR) {
|
||||||
if (! (m_pEncContext && m_bInitialFlag)) {
|
if (! (m_pEncContext && m_bInitialFlag)) {
|
||||||
|
|||||||
@@ -56,9 +56,9 @@ typedef enum {
|
|||||||
RET_FAILED = -1,
|
RET_FAILED = -1,
|
||||||
RET_INVALIDPARAM = -2,
|
RET_INVALIDPARAM = -2,
|
||||||
RET_OUTOFMEMORY = -3,
|
RET_OUTOFMEMORY = -3,
|
||||||
RET_NOTSUPPORTED = -4,
|
RET_NOTSUPPORTED = -4,
|
||||||
RET_UNEXPECTED = -5,
|
RET_UNEXPECTED = -5,
|
||||||
RET_NEEDREINIT = -6
|
RET_NEEDREINIT = -6
|
||||||
} EResult;
|
} EResult;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -80,7 +80,7 @@ typedef enum {
|
|||||||
VIDEO_FORMAT_I420 = 23, /* yuv 4:2:0 planar */
|
VIDEO_FORMAT_I420 = 23, /* yuv 4:2:0 planar */
|
||||||
VIDEO_FORMAT_YV12 = 24, /* yuv 4:2:0 planar */
|
VIDEO_FORMAT_YV12 = 24, /* yuv 4:2:0 planar */
|
||||||
VIDEO_FORMAT_INTERNAL = 25, /* Only Used for SVC decoder testbed */
|
VIDEO_FORMAT_INTERNAL = 25, /* Only Used for SVC decoder testbed */
|
||||||
VIDEO_FORMAT_NV12 = 26, /* y planar + uv packed */
|
VIDEO_FORMAT_NV12 = 26, /* y planar + uv packed */
|
||||||
VIDEO_FORMAT_I422 = 27, /* yuv 4:2:2 planar */
|
VIDEO_FORMAT_I422 = 27, /* yuv 4:2:2 planar */
|
||||||
VIDEO_FORMAT_I444 = 28, /* yuv 4:4:4 planar */
|
VIDEO_FORMAT_I444 = 28, /* yuv 4:4:4 planar */
|
||||||
VIDEO_FORMAT_YUYV = 20, /* yuv 4:2:2 packed */
|
VIDEO_FORMAT_YUYV = 20, /* yuv 4:2:2 packed */
|
||||||
@@ -124,13 +124,13 @@ typedef enum {
|
|||||||
METHOD_DENOISE ,
|
METHOD_DENOISE ,
|
||||||
METHOD_SCENE_CHANGE_DETECTION_VIDEO ,
|
METHOD_SCENE_CHANGE_DETECTION_VIDEO ,
|
||||||
METHOD_SCENE_CHANGE_DETECTION_SCREEN ,
|
METHOD_SCENE_CHANGE_DETECTION_SCREEN ,
|
||||||
METHOD_DOWNSAMPLE ,
|
METHOD_DOWNSAMPLE ,
|
||||||
METHOD_VAA_STATISTICS ,
|
METHOD_VAA_STATISTICS ,
|
||||||
METHOD_BACKGROUND_DETECTION ,
|
METHOD_BACKGROUND_DETECTION ,
|
||||||
METHOD_ADAPTIVE_QUANT ,
|
METHOD_ADAPTIVE_QUANT ,
|
||||||
METHOD_COMPLEXITY_ANALYSIS ,
|
METHOD_COMPLEXITY_ANALYSIS ,
|
||||||
METHOD_COMPLEXITY_ANALYSIS_SCREEN,
|
METHOD_COMPLEXITY_ANALYSIS_SCREEN,
|
||||||
METHOD_IMAGE_ROTATE ,
|
METHOD_IMAGE_ROTATE ,
|
||||||
METHOD_SCROLL_DETECTION,
|
METHOD_SCROLL_DETECTION,
|
||||||
METHOD_MASK
|
METHOD_MASK
|
||||||
} EMethods;
|
} EMethods;
|
||||||
|
|||||||
@@ -39,16 +39,16 @@ WELSVP_NAMESPACE_BEGIN
|
|||||||
#define BGD_OU_SIZE (1<<LOG2_BGD_OU_SIZE)
|
#define BGD_OU_SIZE (1<<LOG2_BGD_OU_SIZE)
|
||||||
#define BGD_OU_SIZE_UV (BGD_OU_SIZE>>1)
|
#define BGD_OU_SIZE_UV (BGD_OU_SIZE>>1)
|
||||||
#define BGD_THD_SAD (2*BGD_OU_SIZE*BGD_OU_SIZE)
|
#define BGD_THD_SAD (2*BGD_OU_SIZE*BGD_OU_SIZE)
|
||||||
#define BGD_THD_ASD_UV (4*BGD_OU_SIZE_UV)
|
#define BGD_THD_ASD_UV (4*BGD_OU_SIZE_UV)
|
||||||
#define LOG2_MB_SIZE (4)
|
#define LOG2_MB_SIZE (4)
|
||||||
#define OU_SIZE_IN_MB (BGD_OU_SIZE >> 4)
|
#define OU_SIZE_IN_MB (BGD_OU_SIZE >> 4)
|
||||||
#define Q_FACTOR (8)
|
#define Q_FACTOR (8)
|
||||||
#define BGD_DELTA_QP_THD (3)
|
#define BGD_DELTA_QP_THD (3)
|
||||||
|
|
||||||
#define OU_LEFT (0x01)
|
#define OU_LEFT (0x01)
|
||||||
#define OU_RIGHT (0x02)
|
#define OU_RIGHT (0x02)
|
||||||
#define OU_TOP (0x04)
|
#define OU_TOP (0x04)
|
||||||
#define OU_BOTTOM (0x08)
|
#define OU_BOTTOM (0x08)
|
||||||
|
|
||||||
CBackgroundDetection::CBackgroundDetection (int32_t iCpuFlag) {
|
CBackgroundDetection::CBackgroundDetection (int32_t iCpuFlag) {
|
||||||
m_eMethod = METHOD_BACKGROUND_DETECTION;
|
m_eMethod = METHOD_BACKGROUND_DETECTION;
|
||||||
|
|||||||
@@ -61,43 +61,43 @@ inline int32_t WelsMemcmp (const void* kpBuf1, const void* kpBuf2, uint32_t uiSi
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief malloc with zero filled utilization in Wels
|
* \brief malloc with zero filled utilization in Wels
|
||||||
*
|
*
|
||||||
* \param i_size uiSize of memory block required
|
* \param i_size uiSize of memory block required
|
||||||
*
|
*
|
||||||
* \return allocated memory pointer exactly, failed in case of NULL return
|
* \return allocated memory pointer exactly, failed in case of NULL return
|
||||||
*
|
*
|
||||||
* \note N/A
|
* \note N/A
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
void* WelsMalloc (const uint32_t kuiSize, char* pTag = NULL);
|
void* WelsMalloc (const uint32_t kuiSize, char* pTag = NULL);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief free utilization in Wels
|
* \brief free utilization in Wels
|
||||||
*
|
*
|
||||||
* \param p data pointer to be free.
|
* \param p data pointer to be free.
|
||||||
* i.e, uint8_t *p = actual data to be free, argv = &p.
|
* i.e, uint8_t *p = actual data to be free, argv = &p.
|
||||||
*
|
*
|
||||||
* \return NONE
|
* \return NONE
|
||||||
*
|
*
|
||||||
* \note N/A
|
* \note N/A
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
void WelsFree (void* pPointer, char* pTag = NULL);
|
void WelsFree (void* pPointer, char* pTag = NULL);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
* \brief reallocation in Wels. Do nothing and continue using old block
|
* \brief reallocation in Wels. Do nothing and continue using old block
|
||||||
* in case the block is large enough currently
|
* in case the block is large enough currently
|
||||||
*
|
*
|
||||||
* \param p memory block required in old time
|
* \param p memory block required in old time
|
||||||
* \param i_size new uiSize of memory block requested
|
* \param i_size new uiSize of memory block requested
|
||||||
* \param sz_real pointer to the old uiSize of memory block
|
* \param sz_real pointer to the old uiSize of memory block
|
||||||
*
|
*
|
||||||
* \return reallocated memory pointer exactly, failed in case of NULL return
|
* \return reallocated memory pointer exactly, failed in case of NULL return
|
||||||
*
|
*
|
||||||
* \note N/A
|
* \note N/A
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
void* WelsRealloc (void* pPointer, uint32_t* pRealSize, const uint32_t kuiSize, char* pTag = NULL);
|
void* WelsRealloc (void* pPointer, uint32_t* pRealSize, const uint32_t kuiSize, char* pTag = NULL);
|
||||||
|
|||||||
@@ -58,16 +58,16 @@ WELSVP_NAMESPACE_BEGIN
|
|||||||
#define MAX_HEIGHT (2304)//MAX_FS_LEVEL51 (36864); MAX_FS_LEVEL51*256/4096 = 2304
|
#define MAX_HEIGHT (2304)//MAX_FS_LEVEL51 (36864); MAX_FS_LEVEL51*256/4096 = 2304
|
||||||
|
|
||||||
#define MB_WIDTH_LUMA (16)
|
#define MB_WIDTH_LUMA (16)
|
||||||
#define PESN (1e-6) // desired float precision
|
#define PESN (1e-6) // desired float precision
|
||||||
#define AQ_INT_MULTIPLY 10000000
|
#define AQ_INT_MULTIPLY 10000000
|
||||||
#define AQ_TIME_INT_MULTIPLY 10000
|
#define AQ_TIME_INT_MULTIPLY 10000
|
||||||
#define AQ_QSTEP_INT_MULTIPLY 100
|
#define AQ_QSTEP_INT_MULTIPLY 100
|
||||||
#define AQ_PESN 10 // (1e-6)*AQ_INT_MULTIPLY
|
#define AQ_PESN 10 // (1e-6)*AQ_INT_MULTIPLY
|
||||||
|
|
||||||
#define MB_TYPE_INTRA4x4 0x00000001
|
#define MB_TYPE_INTRA4x4 0x00000001
|
||||||
#define MB_TYPE_INTRA16x16 0x00000002
|
#define MB_TYPE_INTRA16x16 0x00000002
|
||||||
#define MB_TYPE_INTRA_PCM 0x00000004
|
#define MB_TYPE_INTRA_PCM 0x00000004
|
||||||
#define MB_TYPE_INTRA (MB_TYPE_INTRA4x4 | MB_TYPE_INTRA16x16 | MB_TYPE_INTRA_PCM)
|
#define MB_TYPE_INTRA (MB_TYPE_INTRA4x4 | MB_TYPE_INTRA16x16 | MB_TYPE_INTRA_PCM)
|
||||||
#define IS_INTRA(type) ((type)&MB_TYPE_INTRA)
|
#define IS_INTRA(type) ((type)&MB_TYPE_INTRA)
|
||||||
|
|
||||||
#define WELS_MAX(x, y) ((x) > (y) ? (x) : (y))
|
#define WELS_MAX(x, y) ((x) > (y) ? (x) : (y))
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
#define DENOISE_GRAY_SIGMA (2)
|
#define DENOISE_GRAY_SIGMA (2)
|
||||||
|
|
||||||
#define UV_WINDOWS_RADIUS (2)
|
#define UV_WINDOWS_RADIUS (2)
|
||||||
#define TAIL_OF_LINE8 (7)
|
#define TAIL_OF_LINE8 (7)
|
||||||
|
|
||||||
#define DENOISE_Y_COMPONENT (1)
|
#define DENOISE_Y_COMPONENT (1)
|
||||||
#define DENOISE_U_COMPONENT (2)
|
#define DENOISE_U_COMPONENT (2)
|
||||||
|
|||||||
Reference in New Issue
Block a user