Skip to content

Commit

Permalink
Change picOrderCnt to 2 (#3752)
Browse files Browse the repository at this point in the history
* Change picOrderCnt to 2

changes the picOrderCnt field to 2 (which means the output order
is the same as the decode order) which is more suited to realtime
usage and allows the decoder to immediately decode a frame without
waiting for out-of-order frames. This reduces the decoding latency
on Qualcomm hardware decoders which do not honor the VUI parameter
  max_num_reorder_frames

* bump hashes

* bump asan hashes

* Revert "bump asan hashes"

This reverts commit 7aa8b3d.

* fix last hashes

* update second hash for ASAN

* fix more hashes
  • Loading branch information
fippo authored Jul 3, 2024
1 parent de02617 commit 478e5ab
Show file tree
Hide file tree
Showing 9 changed files with 4,656 additions and 4,634 deletions.
2 changes: 1 addition & 1 deletion codec/encoder/core/inc/parameter_sets.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ uint32_t uiSpsId;
int16_t iMbWidth;
int16_t iMbHeight;
uint32_t uiLog2MaxFrameNum;
// uint32_t uiPocType;
uint32_t uiPocType;
/* POC type 0 */
int32_t iLog2MaxPocLsb;
/* POC type 1 */
Expand Down
12 changes: 10 additions & 2 deletions codec/encoder/core/src/au_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,15 @@ int32_t WelsWriteSpsSyntax (SWelsSPS* pSps, SBitStringAux* pBitStringAux, int32_
}

BsWriteUE (pLocalBitStringAux, pSps->uiLog2MaxFrameNum - 4); // log2_max_frame_num_minus4
BsWriteUE (pLocalBitStringAux, 0/*pSps->uiPocType*/); // pic_order_cnt_type
BsWriteUE (pLocalBitStringAux, pSps->iLog2MaxPocLsb - 4); // log2_max_pic_order_cnt_lsb_minus4
BsWriteUE (pLocalBitStringAux, pSps->uiPocType); // pic_order_cnt_type
if (pSps->uiPocType == 0) {
BsWriteUE (pLocalBitStringAux, pSps->iLog2MaxPocLsb - 4); // log2_max_pic_order_cnt_lsb_minus4
} else if (pSps->uiPocType == 1) {
// TODO: implement
assert (0);
} else {
// no-op for uiPocType 2.
}

BsWriteUE (pLocalBitStringAux, pSps->iNumRefFrames); // max_num_ref_frames
BsWriteOneBit (pLocalBitStringAux, pSps->bGapsInFrameNumValueAllowedFlag); //gaps_in_frame_numvalue_allowed_flag
Expand Down Expand Up @@ -493,6 +500,7 @@ int32_t WelsInitSps (SWelsSPS* pSps, SSpatialLayerConfig* pLayerParam, SSpatialL

//max value of both iFrameNum and POC are 2^16-1, in our encoder, iPOC=2*iFrameNum, so max of iFrameNum should be 2^15-1.--
pSps->uiLog2MaxFrameNum = 15;//16;
pSps->uiPocType = 2;
pSps->iLog2MaxPocLsb = 1 + pSps->uiLog2MaxFrameNum;

pSps->iNumRefFrames = kiNumRefFrame; /* min pRef size when fifo pRef operation*/
Expand Down
18 changes: 16 additions & 2 deletions codec/encoder/core/src/svc_encode_slice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,14 @@ void WelsSliceHeaderWrite (sWelsEncCtx* pCtx, SBitStringAux* pBs, SDqLayer* pCur
BsWriteUE (pBs, pSliceHeader->uiIdrPicId);
}

BsWriteBits (pBs, pSps->iLog2MaxPocLsb, pSliceHeader->iPicOrderCntLsb);
if (pSps->uiPocType == 0) {
BsWriteBits (pBs, pSps->iLog2MaxPocLsb, pSliceHeader->iPicOrderCntLsb);
} else if (pSps->uiPocType == 1) {
// TODO: implement.
assert (0);
} else {
// no-op for uiPocType == 2.
}

if (P_SLICE == pSliceHeader->eSliceType) {
BsWriteOneBit (pBs, pSliceHeader->bNumRefIdxActiveOverrideFlag);
Expand Down Expand Up @@ -359,7 +366,14 @@ void WelsSliceHeaderExtWrite (sWelsEncCtx* pCtx, SBitStringAux* pBs, SDqLayer* p
BsWriteUE (pBs, pSliceHeader->uiIdrPicId);
}

BsWriteBits (pBs, pSps->iLog2MaxPocLsb, pSliceHeader->iPicOrderCntLsb);
if (pSps->uiPocType == 0) {
BsWriteBits (pBs, pSps->iLog2MaxPocLsb, pSliceHeader->iPicOrderCntLsb);
} else if (pSps->uiPocType == 1) {
// TODO: implement.
assert (0);
} else {
// no-op for uiPocType == 2.
}
// {
if (P_SLICE == pSliceHeader->eSliceType) {
BsWriteOneBit (pBs, pSliceHeader->bNumRefIdxActiveOverrideFlag);
Expand Down
6 changes: 3 additions & 3 deletions test/api/decode_api_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,9 +781,9 @@ const uint32_t kiFrameNum = 100; //DO NOT CHANGE!
const char* const pHashStr[][2] = { //DO NOT CHANGE!
// Allow for different output depending on whether averaging is done
// vertically or horizontally first when downsampling.
{ "d5fb6d72f8cc0ea4b037e883598c162fd32b475d", "0fc7e06d0d766ac911730da2aa9e953bc858a161" },
{ "17203f07486e895aef7c1bf94133fd731caba572", "1d47de674c9c44d8292ee00fa053a42bb9383614" },
{ "86bf890aef2abe24abe40ebe3d9ec76a25ddebe7", "43eaac708413c109ca120c5d570176f1c9b4036c" }
{ "c42f9f9bd9084a7fe1dc2e1788cdb1dc3a1cbc61", "8c1a1f2d1c01ac1f9da2f883a55191965691d199" },
{ "93b2df27e94464f355b60343c786105075fc96d8", "a5634698fef84d402218806f48c6b48e79d4ec4d" },
{ "8e2d7cd8de6dfb03189a3ac13c289393600780a2", "c9904fdfed2108414597af96a2561680d9a17acd" }
};

class DecodeParseAPI : public ::testing::TestWithParam<EncodeDecodeFileParamBase>, public EncodeDecodeTestBase {
Expand Down
4 changes: 2 additions & 2 deletions test/api/decode_encode_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ TEST_P (DecodeEncodeTest, CompareOutput) {
}
}
static const DecodeEncodeFileParam kFileParamArray[] = {
{"res/test_vd_1d.264", "47cdeeb156991a61af309f4145b23643556d35a2", 320, 192, 12.0f},
{"res/test_vd_rc.264", "37f9f80c7330ab35f611c6cb6d009c2f1e7815ab", 320, 192, 12.0f},
{"res/test_vd_1d.264", "34fc3aee85cc0b0223c2701d810a536fe3818a00", 320, 192, 12.0f},
{"res/test_vd_rc.264", "9f15b0677b5f7daa922079ec4fa49e3f457fc998", 320, 192, 12.0f},
};


Expand Down
32 changes: 16 additions & 16 deletions test/api/encoder_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,78 +103,78 @@ TEST_P (EncoderOutputTest, CompareOutput) {
static const EncodeFileParam kFileParamArray[] = {
{
"res/CiscoVT2people_320x192_12fps.yuv",
{"19dd24f5a3ae9e9582024db5b63696948b8ac82f"}, CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, false
{"672a52fb6b6e6d52b5b3f3480d13d44e88481fb9"}, CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, false
},
{
"res/CiscoVT2people_160x96_6fps.yuv",
{"7acf58ba0e72ffc4725ad897ed45f990b9ab8413"}, CAMERA_VIDEO_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
{"08ade1853e4e49d50be675393780e75519586143"}, CAMERA_VIDEO_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
},
{
"res/Static_152_100.yuv",
{"d27c6a56efe899528ddd3f8f3b33efb8f3ce2d51"}, CAMERA_VIDEO_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
{"e60f12e3c24500d4306d812b0811d3c21855dd1c"}, CAMERA_VIDEO_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
},
{
"res/CiscoVT2people_320x192_12fps.yuv",
{"5111d90ce90849020b7ed830cc2f962ccfea4457"}, CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_RASTER_SLICE, false, 1, false, false, false // One slice per MB row
{"266de2d059a00ad2f28304e7eb378543ea7d85ab"}, CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_RASTER_SLICE, false, 1, false, false, false // One slice per MB row
},
{
"res/CiscoVT2people_320x192_12fps.yuv",
{"91ca058f728a001546ae34ce1b7a00163800faac"}, CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, true, 1, false, false, false
{"913e49c787a0abdb378e9bc55bcffc27da89b965"}, CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, true, 1, false, false, false
},
{
"res/CiscoVT2people_320x192_12fps.yuv",
// Allow for different output depending on whether averaging is done
// vertically or horizontally first when downsampling.
{ "4faa2a17c6629135af43c2392531f4ce954ec92d", "a4c2caccada00189c683cd61c6f0bb995d09aeff" },
{ "e626f7efa3d54da15794407c15b7c694f7ddd383", "eb4adc831563ce4f02f2942f52c992da760b4113" },
CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 2, false, false, false
},
{
"res/Cisco_Absolute_Power_1280x720_30fps.yuv",
{"abd7aa034f916659a9f68b33160b404fb43411dd"}, CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, false, false, false
{"53f5681a0c2b7068f4edc94538d6133a657df25d"}, CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, false, false, false
},
{
"res/Cisco_Absolute_Power_1280x720_30fps.yuv",
// Allow for different output depending on whether averaging is done
// vertically or horizontally first when downsampling.
{ "291fba557fdfd0e077ff6681425dc81c65704b62", "9e4fb2b503a877c21441545ee4f0cd5416dbe5e9" },
{ "0d4bf6a3b6f09d6de7bbce6daf8002c614ee6241", "a32db3cfa66568e231d1f580d239d6468d26ce9a" },
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
{
"res/CiscoVT2people_320x192_12fps.yuv",
{"dd51c2007f944ee752532c74c4d38da1413acd88"}, SCREEN_CONTENT_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, false
{"fd57470eebb9b334e8edcb8b47f7fb5b5868f111"}, SCREEN_CONTENT_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, false
},
{
"res/CiscoVT2people_160x96_6fps.yuv",
{"564b0e774f0157c91c7ff3548708f88fb0f3abc6"}, SCREEN_CONTENT_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
{"5f63e723c3ec82fad186b48fcbcfb54730ce3b26"}, SCREEN_CONTENT_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
},
{
"res/Static_152_100.yuv",
{"9b88952f0ec5ebf3e25e642b8a9f355854681f57"}, SCREEN_CONTENT_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
{"e77a5b0ffb48753556e617544616fb06a049e9be"}, SCREEN_CONTENT_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
},
{
"res/Cisco_Absolute_Power_1280x720_30fps.yuv",
{"7db72f0d6f347f57d5137a5cd4de2a3e3fba5b95"}, SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, false, false, false
{"f01e41426ca49932a8f1f67ad59a1700a3fa7fee"}, SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, false, false, false
},
//for different strategy
{
"res/Cisco_Absolute_Power_1280x720_30fps.yuv",
{"30b877303081e2c5ee579d8bbeb2094abd2018c1"}, SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, true, true, false
{"4684962979bc306e35de93bed58cc84938abcdee"}, SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, true, true, false
},
{
"res/CiscoVT2people_320x192_12fps.yuv",
{"3c27f9134d79edaa769741005b569565c2367e6f"}, CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, true //turn on cabac
{"d31a72395a4ca760c5b86a06901a2557e0373e76"}, 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",
{"e5a91447595a2a3560f7cdabbb62b694134fe4ca"}, CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, false, false, true
{"8bef37fa5965d5e650c1170d938423269f7406ac"}, CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, false, false, true
},

{
"res/Cisco_Absolute_Power_1280x720_30fps.yuv",
{"77aa8bc391a84d308a09d4fbb859f4a0e8ae8196"}, CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_FIXEDSLCNUM_SLICE, false, 1, false, false, true
{"c5cb4a6f55c10485aa90f8b237fcb8697ba70d43"}, CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_FIXEDSLCNUM_SLICE, false, 1, false, false, true
},

};
Expand Down
Loading

0 comments on commit 478e5ab

Please sign in to comment.