[FFmpeg-devel] [PATCH 2/2] Provided support for MPEG-5 EVC (Essential Video Coding) codec

Michael Niedermayer michael at niedermayer.cc
Mon Aug 1 22:30:53 EEST 2022


On Mon, Aug 01, 2022 at 11:29:01AM +0200, Dawid Kozinski wrote:
[...]

> +static int get_nalu_type(const uint8_t *bits, int bits_size)
> +{
> +    int unit_type_plus1 = 0;
> +
> +    if(bits_size >= EVC_NAL_HEADER_SIZE) {
> +        unsigned char *p = (unsigned char *)bits;
> +        // forbidden_zero_bit
> +        if ((p[0] & 0x80) != 0) {
> +            av_log(NULL, AV_LOG_ERROR, "Cannot get bitstream information. Malformed bitstream.\n");
> +            return -1;
> +        }
> +
> +        // nal_unit_type
> +        unit_type_plus1 = (p[0] >> 1) & 0x3F;
> +    }
> +
> +    return unit_type_plus1 - 1;
> +}
> +

> +static uint32_t read_nal_unit_length(const uint8_t *bits, int bits_size)
> +{
> +    uint32_t nalu_len = 0;
> +
> +    if(bits_size >= EVC_NAL_UNIT_LENGTH_BYTE) {
> +
> +        int t = 0;
> +        unsigned char *p = (unsigned char *)bits;
> +
> +        for(int i=0; i<EVC_NAL_UNIT_LENGTH_BYTE; i++) {
> +            t = (t << 8) | p[i];
> +        }
> +
> +        nalu_len = t;
> +        if(nalu_len == 0) {
> +            av_log(NULL, AV_LOG_ERROR, "Invalid bitstream size!\n");

These av_log() are a problem as they are in probing code
probing code would be run on all kinds of input, most not EVC so "errors"
are common while at the same time they are not real errors. That would
make probing very noisy

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
"Used only once"    - "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20220801/a822d5ec/attachment.sig>


More information about the ffmpeg-devel mailing list