Skip to content

fixed nal_unit_length parsing#21

Merged
mpeg5 merged 2 commits intomasterfrom
dev-FixSyntaxNaluLength
Mar 22, 2022
Merged

fixed nal_unit_length parsing#21
mpeg5 merged 2 commits intomasterfrom
dev-FixSyntaxNaluLength

Conversation

@kpchoi
Copy link
Copy Markdown
Collaborator

@kpchoi kpchoi commented Mar 21, 2022

The previous parsing scheme of "nal_unit_length" was not correct.
It should be u(32) syntax.
According to standard the parsing scheme has changed to support u(32).

app/xevd_app.c Outdated
}
}

/* read 'nal_unit_length' syntax in Annex-B of EVC standard */
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't that be AVCC format instead of Annex-B?
AnnexB format: ([start code] NALU) | ( [start code] NALU) |
AVCC format: ([length] NALU) | ([length] NALU) |

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using annex-b or not is highly depending on file format.
If the muxing and parsing format is "evc" format which is sequence of elementary stream only, it have to use annex-b for fining bitstream boundary.
but, I guess that annex-b syntax would not be required for mp4 file format.
I remember H.264 and H.265 also doesn't store annex-b start code into mp4 files format (please correct me if it is not correct).
Do you think my comment is reasonable? and it could be handled?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything is clear. I handled "Annex-B" word in the following comment line /* read 'nal_unit_length' syntax in Annex-B of EVC standard */ wrong way.
I handled Annex-B as a bitstream format, meanwhile it is not about bitstream format, it's all about the reference to the section of the ISO document, Annex-B of ISO IEC 23094-: 2020.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ISO IEC 23094-: 2020 is specification of EVC codec. and Annex-B is a part of it.
Annex-B format is mainly for "xxx.evc" format (elementary stream).
I believe the mp4 file format (exactly named "iso-based file format") doesn't need to store Annex-B syntax to sample data.
If my explanation is different from you, then, let me know.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The source of my confusion about the Annex-B is the fact that I've made wrong assumptions related to elementary stream formats.
Namely I've assumed that elementary video stream in an application can be in either Annex-B or AVCC format defined as follows:

  • The Annex-B format delimits NALUs with two bytes of zeroes, followed by one or three bytes of zeroes, followed by the number 1 (called a start code, for example, 00000001).
    ([start code] NALU) | ( [start code] NALU) |
  • The AVCC format also wraps NALUs, but each NALU is preceded by a value that indicates the size of the NALU (usually four bytes).
    ([length] NALU) | ([length] NALU)

It seems that above definition of Annex-B bitstream format which is true for h264 is not true for EVC.
The Annex-B bitstream format for EVC has been described in SO IEC 23094-: 2020 documents as follows:
aw_bitstream_nal_unit( ) {
nal_unit_length
nal_unit( nal_unit_length )
}

app/xevd_app.c Outdated
}

/* read 'nal_unit_length' syntax in Annex-B of EVC standard */
static int read_nalu_len(void * buf)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't that be part of public API? I mean read_nalu_len function.
XEVD clients have to read NAL unit sizes from EVC stream while decoding EVC stream.
The only place that provides the information on how to do in correct way is the source code of xevd_app reference application.
Do you think it's enough?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will try to add a new API named "xevd_info( )" to get brief information of input bitstream.
I think we can give nal unit length if it is annex-b format, and several more important information.
Please wait a little bit.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkozinski

Hi, I added new API for getting brief information of input bitstream.
Review again please.
Espeically, review the funciton "read_bitstream()" in xevd_app.c would be good for understanding.

Copy link
Copy Markdown
Owner

@mpeg5 mpeg5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mpeg5 mpeg5 merged commit cec1ea6 into master Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants