add VUI for base layer

This commit is contained in:
ruil2 2015-03-13 14:31:08 +08:00
parent d7af7cedf9
commit c109f4dc8d
8 changed files with 7732 additions and 7704 deletions

View File

@ -75,7 +75,7 @@ uint8_t iLevelIdc;
// bool bDirect8x8InferenceFlag; // bool bDirect8x8InferenceFlag;
bool bFrameCroppingFlag; bool bFrameCroppingFlag;
// bool bVuiParamPresentFlag; bool bVuiParamPresentFlag;
// bool bTimingInfoPresentFlag; // bool bTimingInfoPresentFlag;
// bool bFixedFrameRateFlag; // bool bFixedFrameRateFlag;

View File

@ -196,6 +196,32 @@ static inline ELevelIdc WelsGetLevelIdc (const SWelsSPS* kpSps, float fFrameRate
return LEVEL_5_1; //final decision: select the biggest level return LEVEL_5_1; //final decision: select the biggest level
} }
int32_t WelsWriteVUI (SWelsSPS* pSps, SBitStringAux* pBitStringAux) {
SBitStringAux* pLocalBitStringAux = pBitStringAux;
assert (pSps != NULL && pBitStringAux != NULL);
BsWriteOneBit (pLocalBitStringAux, false); //aspect_ratio_info_present_flag
BsWriteOneBit (pLocalBitStringAux, false); //overscan_info_present_flag
BsWriteOneBit (pLocalBitStringAux, false); //video_signal_type_present_flag
BsWriteOneBit (pLocalBitStringAux, false); //chroma_loc_info_present_flag
BsWriteOneBit (pLocalBitStringAux, false); //timing_info_present_flag
BsWriteOneBit (pLocalBitStringAux, false); //nal_hrd_parameters_present_flag
BsWriteOneBit (pLocalBitStringAux, false); //vcl_hrd_parameters_present_flag
BsWriteOneBit (pLocalBitStringAux, false); //pic_struct_present_flag
BsWriteOneBit (pLocalBitStringAux, true); //bitstream_restriction_flag
//
BsWriteOneBit (pLocalBitStringAux, false); //motion_vectors_over_pic_boundaries_flag
BsWriteUE (pLocalBitStringAux, 0); //max_bytes_per_pic_denom
BsWriteUE (pLocalBitStringAux, 0); //max_bits_per_mb_denom
BsWriteUE (pLocalBitStringAux, 0); //log2_max_mv_length_horizontal
BsWriteUE (pLocalBitStringAux, 0); //log2_max_mv_length_vertical
BsWriteUE (pLocalBitStringAux, 0); //max_num_reorder_frames
BsWriteUE (pLocalBitStringAux, pSps->iNumRefFrames); //max_dec_frame_buffering
return 0;
}
/*! /*!
************************************************************************************* *************************************************************************************
@ -210,7 +236,7 @@ static inline ELevelIdc WelsGetLevelIdc (const SWelsSPS* kpSps, float fFrameRate
* \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) { int32_t WelsWriteSpsSyntax (SWelsSPS* pSps, SBitStringAux* pBitStringAux, int32_t* pSpsIdDelta, bool bBaseLayer) {
SBitStringAux* pLocalBitStringAux = pBitStringAux; SBitStringAux* pLocalBitStringAux = pBitStringAux;
assert (pSps != NULL && pBitStringAux != NULL); assert (pSps != NULL && pBitStringAux != NULL);
@ -255,14 +281,15 @@ int32_t WelsWriteSpsSyntax (SWelsSPS* pSps, SBitStringAux* pBitStringAux, int32_
BsWriteUE (pLocalBitStringAux, pSps->sFrameCrop.iCropBottom); // frame_crop_bottom_offset BsWriteUE (pLocalBitStringAux, pSps->sFrameCrop.iCropBottom); // frame_crop_bottom_offset
} }
BsWriteOneBit (pLocalBitStringAux, 0/*pSps->bVuiParamPresentFlag*/); // vui_parameters_present_flag BsWriteOneBit (pLocalBitStringAux, pSps->bVuiParamPresentFlag); // vui_parameters_present_flag
if (pSps->bVuiParamPresentFlag && bBaseLayer)
WelsWriteVUI (pSps, pBitStringAux);
return 0; return 0;
} }
int32_t WelsWriteSpsNal (SWelsSPS* pSps, SBitStringAux* pBitStringAux, int32_t* pSpsIdDelta) { int32_t WelsWriteSpsNal (SWelsSPS* pSps, SBitStringAux* pBitStringAux, int32_t* pSpsIdDelta) {
WelsWriteSpsSyntax (pSps, pBitStringAux, pSpsIdDelta); WelsWriteSpsSyntax (pSps, pBitStringAux, pSpsIdDelta, true);
BsRbspTrailingBits (pBitStringAux); BsRbspTrailingBits (pBitStringAux);
@ -286,7 +313,7 @@ int32_t WelsWriteSpsNal (SWelsSPS* pSps, SBitStringAux* pBitStringAux, int32_t*
int32_t WelsWriteSubsetSpsSyntax (SSubsetSps* pSubsetSps, SBitStringAux* pBitStringAux , int32_t* pSpsIdDelta) { int32_t WelsWriteSubsetSpsSyntax (SSubsetSps* pSubsetSps, SBitStringAux* pBitStringAux , int32_t* pSpsIdDelta) {
SWelsSPS* pSps = &pSubsetSps->pSps; SWelsSPS* pSps = &pSubsetSps->pSps;
WelsWriteSpsSyntax (pSps, pBitStringAux, pSpsIdDelta); WelsWriteSpsSyntax (pSps, pBitStringAux, pSpsIdDelta, false);
if (pSps->uiProfileIdc == PRO_SCALABLE_BASELINE || pSps->uiProfileIdc == PRO_SCALABLE_HIGH) { if (pSps->uiProfileIdc == PRO_SCALABLE_BASELINE || pSps->uiProfileIdc == PRO_SCALABLE_HIGH) {
SSpsSvcExt* pSubsetSpsExt = &pSubsetSps->sSpsSvcExt; SSpsSvcExt* pSubsetSpsExt = &pSubsetSps->sSpsSvcExt;
@ -481,6 +508,7 @@ int32_t WelsInitSps (SWelsSPS* pSps, SSpatialLayerConfig* pLayerParam, SSpatialL
pLayerParam->uiLevelIdc = uiLevel; pLayerParam->uiLevelIdc = uiLevel;
} }
pSps->iLevelIdc = g_kuiLevelMaps[pLayerParam->uiLevelIdc - 1]; pSps->iLevelIdc = g_kuiLevelMaps[pLayerParam->uiLevelIdc - 1];
pSps->bVuiParamPresentFlag = true;
return 0; return 0;
} }

View File

@ -130,8 +130,8 @@ TEST_P (DecodeEncodeTest, CompareOutput) {
} }
} }
static const DecodeEncodeFileParam kFileParamArray[] = { static const DecodeEncodeFileParam kFileParamArray[] = {
{"res/test_vd_1d.264", "63fe502aa2d63869cc888592e4984b3d6e8c3bef", 320, 192, 12.0f}, {"res/test_vd_1d.264", "de9d332791d0d4e4256b88c0d7c7ece1cb7541b9", 320, 192, 12.0f},
{"res/test_vd_rc.264", "fda7fdfbef853ec7aaf3e236dcfa7c0ba9c2314a", 320, 192, 12.0f}, {"res/test_vd_rc.264", "2493aecf6d3623ef5736586c35986fe56d554e5e", 320, 192, 12.0f},
}; };

View File

@ -2511,7 +2511,7 @@ const uint32_t kiHeight = 96; //DO NOT CHANGE!
const uint32_t kiFrameRate = 12; //DO NOT CHANGE! const uint32_t kiFrameRate = 12; //DO NOT CHANGE!
const uint32_t kiFrameNum = 100; //DO NOT CHANGE! const uint32_t kiFrameNum = 100; //DO NOT CHANGE!
const char* pHashStr[] = { //DO NOT CHANGE! const char* pHashStr[] = { //DO NOT CHANGE!
"d1c255a57aa2c5e1192a90680c00e6ee3e73fe59", "cb14de85df405e2fa1c90c0d1ed715e917d51a72",
"f350001c333902029800bd291fbed915a4bdf19a", "f350001c333902029800bd291fbed915a4bdf19a",
"eb9d853b7daec03052c4850027ac94adc84c3a7e" "eb9d853b7daec03052c4850027ac94adc84c3a7e"
}; };

View File

@ -103,65 +103,65 @@ TEST_P (EncoderOutputTest, CompareOutput) {
static const EncodeFileParam kFileParamArray[] = { static const EncodeFileParam kFileParamArray[] = {
{ {
"res/CiscoVT2people_320x192_12fps.yuv", "res/CiscoVT2people_320x192_12fps.yuv",
"16b145cf76a677d87240ef6c8efff0ff8d3a2f3a", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, false "a3ad18c9973a0bb540d2faff5a6a20ba2afc8595", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, false
}, },
{ {
"res/CiscoVT2people_160x96_6fps.yuv", "res/CiscoVT2people_160x96_6fps.yuv",
"874ab77ba13f199d70b67cd75f8e23baf482c1ed", CAMERA_VIDEO_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false "522b18bbd733f193ab8ad6b9ee1020e5ea9c236f", CAMERA_VIDEO_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
}, },
{ {
"res/Static_152_100.yuv", "res/Static_152_100.yuv",
"73b40ad71e1f1ffbbd5425de2b094ccbdfa798a6", CAMERA_VIDEO_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false "923daa2b2437830e4afceef183842b71bb637a58", CAMERA_VIDEO_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
}, },
{ {
"res/CiscoVT2people_320x192_12fps.yuv", "res/CiscoVT2people_320x192_12fps.yuv",
"c1b187be92a35ac8f4f9724b594559e0394c1df8", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_ROWMB_SLICE, false, 1, false, false, false // One slice per MB row "ca20a1a47b8c865e740570d7e43ef2c11b51eafb", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_ROWMB_SLICE, false, 1, false, false, false // One slice per MB row
}, },
{ {
"res/CiscoVT2people_320x192_12fps.yuv", "res/CiscoVT2people_320x192_12fps.yuv",
"959a94ea684bf37eaf39909f6460e02b50ad0a5f", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, true, 1, false, false, false "c6c5c92b6c7d12a4a21701994d024f8c77c6a8a5", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, true, 1, false, false, false
}, },
{ {
"res/CiscoVT2people_320x192_12fps.yuv", "res/CiscoVT2people_320x192_12fps.yuv",
"684e6d141ada776892bdb01ee93efe475983ed36", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 2, false, false, false "a51aeb5313b24c75e05a96655066f6b2e19b6552", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 2, false, false, false
}, },
{ {
"res/Cisco_Absolute_Power_1280x720_30fps.yuv", "res/Cisco_Absolute_Power_1280x720_30fps.yuv",
"27a595af0e9598feb4dc1403fd99affddfa51f46", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, false, false, false "b25c942962e588395630ca9be1480221075f3e34", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, false, false, false
}, },
{ {
"res/Cisco_Absolute_Power_1280x720_30fps.yuv", "res/Cisco_Absolute_Power_1280x720_30fps.yuv",
"68c3220e49b7a57d563faf7c99a870ab34a23400", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SINGLE_SLICE, false, 4, false, false, false "9f6f4a819b4a304b491be74f349cb5b226e2b5ab", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SINGLE_SLICE, false, 4, false, false, false
}, },
// the following values may be adjusted for times since we start tuning the strategy // the following values may be adjusted for times since we start tuning the strategy
{ {
"res/CiscoVT2people_320x192_12fps.yuv", "res/CiscoVT2people_320x192_12fps.yuv",
"1645c417562c5249e58b49b6e467d8b53febb226", SCREEN_CONTENT_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, false "48f2a03d23541cc05056425374a74c63759f76c5", SCREEN_CONTENT_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, false
}, },
{ {
"res/CiscoVT2people_160x96_6fps.yuv", "res/CiscoVT2people_160x96_6fps.yuv",
"51fc38d467509f94e85f9678f11429220e46d862", SCREEN_CONTENT_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false "b98d33e3fc68fafd8d86ec22b23870ba1e5cf926", SCREEN_CONTENT_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
}, },
{ {
"res/Static_152_100.yuv", "res/Static_152_100.yuv",
"1af33ad3d8c40756ef1f6074c019a06535c35ab0", SCREEN_CONTENT_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false "dc054763d3a4280e75c4864eba5004ca643202b5", SCREEN_CONTENT_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
}, },
{ {
"res/Cisco_Absolute_Power_1280x720_30fps.yuv", "res/Cisco_Absolute_Power_1280x720_30fps.yuv",
"e032f8f8b153f37e614676735074cdce843032de", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, false, false, false "46e2ea054fd1f48c9d803affa5e08c69bcf38eac", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, false, false, false
}, },
//for different strategy //for different strategy
{ {
"res/Cisco_Absolute_Power_1280x720_30fps.yuv", "res/Cisco_Absolute_Power_1280x720_30fps.yuv",
"28e290b204257eae5c735b2b96491358ec14221e", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, true, true, false "de239bc36915c6441dd4f4bf66d0474e4c520348", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, true, true, false
}, },
{ {
"res/CiscoVT2people_320x192_12fps.yuv", "res/CiscoVT2people_320x192_12fps.yuv",
"59e51ffc741172df4a729d7fc1f85645885311a5", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, true //turn on cabac "f6f87a961fb3280475d1a5f733200dcaa52111f1", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, true //turn on cabac
}, },
{ {
"res/Cisco_Absolute_Power_1280x720_30fps.yuv", "res/Cisco_Absolute_Power_1280x720_30fps.yuv",
"f4361779554ae66ce62308f1e01218369ca0edf4", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, false, false, true "44e2906594c5987dd24c7423752fe4e11e3d6296", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, false, false, true
}, },
}; };