-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix RBSP issue, where 0x03 should be removed. v5.0.178 v6.0.75 #3597
Fix RBSP issue, where 0x03 should be removed. v5.0.178 v6.0.75 #3597
Conversation
…represents any 2 bit pattern: 00, 01, 10, or 11)
Thank you for the PR. This PR is an enhancement PR.
|
Thank you for your reply. I referred to the following code. https://github.com/mirror/x264/blob/master/common/bitstream.c static uint8_t *nal_escape_c( uint8_t *dst, uint8_t *src, uint8_t *end )
{
if( src < end ) *dst++ = *src++;
if( src < end ) *dst++ = *src++;
while( src < end )
{
if( src[0] <= 0x03 && !dst[-2] && !dst[-1] ) // this
*dst++ = 0x03;
*dst++ = *src++;
}
return dst;
} |
There indeed is this logic, that is, if the original data in the video is
|
Please add the corresponding utest cases. For the various scenarios mentioned in the specifications, test cases need to be added for verification and testing.
|
@feixintianxia I revisited the code logic, it seems I misunderstood it before, this modification should be fine. Could you please help to add some unit tests? Thanks.
|
Nice work! Thank you all @feixintianxia @xiaozhihong @chundonglinlin ! 👍 |
I added some utests and found that the boundary conditions were not handled correctly, the following case will fail: VOID TEST(KernelCodecTest, VideoFormatRbspEdge)
{
if (true) {
vector<uint8_t> nalu = {0x00, 0x00, 0x03};
vector<uint8_t> expect = {0x00, 0x00, 0x03};
vector<uint8_t> rbsp(nalu.size());
SrsBuffer b((char*)nalu.data(), nalu.size());
int nb_rbsp = srs_rbsp_remove_emulation_bytes(&b, rbsp);
ASSERT_EQ(nb_rbsp, (int)expect.size());
EXPECT_TRUE(srs_bytes_equals(rbsp.data(), expect.data(), nb_rbsp));
} Fixed by 5e6784c
|
This reverts commit 5b12c27.
ISO_IEC_14496-10-AVC-2012.pdf, page 65 7.4.1.1 Encapsulation of an SODB within an RBSP (informative) ... 00 00 03 xx, the 03 byte should be drop where xx represents any 2 bit pattern: 00, 01, 10, or 11. --------- Co-authored-by: john <[email protected]> Co-authored-by: chundonglinlin <[email protected]> Co-authored-by: winlin <[email protected]>
ISO_IEC_14496-10-AVC-2012.pdf, page 65 7.4.1.1 Encapsulation of an SODB within an RBSP (informative) ... 00 00 03 xx, the 03 byte should be drop where xx represents any 2 bit pattern: 00, 01, 10, or 11. --------- Co-authored-by: john <[email protected]> Co-authored-by: chundonglinlin <[email protected]> Co-authored-by: winlin <[email protected]>
ISO_IEC_14496-10-AVC-2012.pdf, page 65 7.4.1.1 Encapsulation of an SODB within an RBSP (informative) ... 00 00 03 xx, the 03 byte should be drop where xx represents any 2 bit pattern: 00, 01, 10, or 11. --------- Co-authored-by: john <[email protected]> Co-authored-by: chundonglinlin <[email protected]> Co-authored-by: winlin <[email protected]>
ISO_IEC_14496-10-AVC-2012.pdf, page 65
7.4.1.1 Encapsulation of an SODB within an RBSP (informative)
... 00 00 03 xx, the 03 byte should be drop where xx represents any 2 bit pattern: 00, 01, 10, or 11.
Co-authored-by: john [email protected]
Co-authored-by: chundonglinlin [email protected]