[FFmpeg-devel] [PATCH v4 2/4] lavc/avs3_parser: add avs3 parser

hwren hwrenx at 126.com
Wed Aug 19 09:18:04 EEST 2020




















At 2020-08-19 01:00:57, "Andreas Rheinhardt" <andreas.rheinhardt at gmail.com> wrote:
>hwrenx at 126.com:
>> From: hwren <hwrenx at 126.com>
>> 
>> Signed-off-by: hbj <hanbj at pku.edu.cn>
>> Signed-off-by: hwren <hwrenx at 126.com>
>> ---
>> diff --git a/libavcodec/avs3_parser.h b/libavcodec/avs3_parser.h
>> new file mode 100644
>> index 0000000000..afc6d235b9
>> --- /dev/null
>> +++ b/libavcodec/avs3_parser.h
>> @@ -0,0 +1,64 @@
>> +/*
>> + * AVS3-P2/IEEE1857.10 video parser.
>> + * Copyright (c) 2020 Zhenyu Wang <wangzhenyu at pkusz.edu.cn>
>> + *                    Bingjie Han <hanbj at pkusz.edu.cn>
>> + *                    Huiwen Ren  <hwrenx at gmail.com>
>> + *
>> + * This file is part of FFmpeg.
>> + *
>> + * FFmpeg is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU Lesser General Public
>> + * License as published by the Free Software Foundation; either
>> + * version 2.1 of the License, or (at your option) any later version.
>> + *
>> + * FFmpeg is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> + * Lesser General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU Lesser General Public
>> + * License along with FFmpeg; if not, write to the Free Software
>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>> + */
>> +
>> +#ifndef AVCODEC_AVS3PARSER_H
>> +#define AVCODEC_AVS3PARSER_H
>> +
>> +#include "parser.h"
>> +
>> +#define AVS3_NAL_START_CODE          0x010000
>> +#define AVS3_SEQ_START_CODE          0xB0
>> +#define AVS3_SEQ_END_CODE            0xB1
>> +#define AVS3_USER_DATA_START_CODE    0xB2
>> +#define AVS3_INTRA_PIC_START_CODE    0xB3
>> +#define AVS3_UNDEF_START_CODE        0xB4
>> +#define AVS3_EXTENSION_START_CODE    0xB5
>> +#define AVS3_INTER_PIC_START_CODE    0xB6
>> +#define AVS3_VIDEO_EDIT_CODE         0xB7
>> +#define AVS3_FIRST_SLICE_START_CODE  0x00
>> +#define AVS3_PROFILE_BASELINE_MAIN   0x20
>> +#define AVS3_PROFILE_BASELINE_MAIN10 0x22
>> +
>> +#define ISPIC(x) ((x) == AVS3_INTRA_PIC_START_CODE || (x) == AVS3_INTER_PIC_START_CODE)
>> +#define ISUNIT(x) ((x) == AVS3_SEQ_START_CODE || ISPIC(x))
>> +
>> +static const AVRational avs3_frame_rate_tab[16] = {
>> +    { 0    , 0   }, // forbid
>> +    { 24000, 1001},
>> +    { 24   , 1   },
>> +    { 25   , 1   },
>> +    { 30000, 1001},
>> +    { 30   , 1   },
>> +    { 50   , 1   },
>> +    { 60000, 1001},
>> +    { 60   , 1   },
>> +    { 100  , 1   },
>> +    { 120  , 1   },
>> +    { 200  , 1   },
>> +    { 240  , 1   },
>> +    { 300  , 1   },
>> +    { 0    , 0   }, // reserved
>> +    { 0    , 0   }  // reserved
>> +};
>> +
>> +#endif /* AVCODEC_AVS3PARSER_H */
>
>None of the stuff in this header file (except the '#include "parser.h"')
>is parser-specific. It should be part of a generic avs3 header file. And
>the frame rate table should not be defined in said header file, as this
>will lead to duplications of the table. If it is used in more than one
>place, it should be declared via extern in this header file; if not, it
>should just be declared inside the file that uses it (right now, only
>the parser uses it).
>(If it is used in more than one library, then it needs to exist in these
>libraries separately (or it needs to be avpriv).)

Indeed. There would be a new file as avs3.h including all those common
definitions. avs3_parser.h will be removed.

Thanks.

>
>- Andreas
>_______________________________________________
>ffmpeg-devel mailing list
>ffmpeg-devel at ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".




More information about the ffmpeg-devel mailing list