* [FFmpeg-devel] [PATCH] AVS3: add support for AVS3 High profile - same syntax as AVS3 Main profile
@ 2022-02-26 5:50 Paul Higgs
2022-02-26 7:18 ` lance.lmwang
0 siblings, 1 reply; 4+ messages in thread
From: Paul Higgs @ 2022-02-26 5:50 UTC (permalink / raw)
To: ffmpeg-devel
This patch adds high level syntax support for parsing AVS3 High profile bitstreams.
Latest AVS3 specification including High profile is available at http://www.avs.org.cn/AVS3_download/en_index.asp
Signed-off-by: Paul Higgs <paul_higgs@hotmail.com>
---
libavcodec/avs3.h | 2 ++
libavcodec/avs3_parser.c | 8 ++++----
libavformat/avs3dec.c | 2 +-
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/libavcodec/avs3.h b/libavcodec/avs3.h
index 4189d9b583..c8caa58b0a 100644
--- a/libavcodec/avs3.h
+++ b/libavcodec/avs3.h
@@ -35,6 +35,8 @@
#define AVS3_FIRST_SLICE_START_CODE 0x00
#define AVS3_PROFILE_BASELINE_MAIN 0x20
#define AVS3_PROFILE_BASELINE_MAIN10 0x22
+#define AVS3_PROFILE_BASELINE_HIGH 0x30
+#define AVS3_PROFILE_BASELINE_HIGH10 0x32
#define AVS3_ISPIC(x) ((x) == AVS3_INTRA_PIC_START_CODE || (x) == AVS3_INTER_PIC_START_CODE)
#define AVS3_ISUNIT(x) ((x) == AVS3_SEQ_START_CODE || AVS3_ISPIC(x))
diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
index d04d96a03a..483b38fe76 100644
--- a/libavcodec/avs3_parser.c
+++ b/libavcodec/avs3_parser.c
@@ -91,11 +91,11 @@ static void parse_avs3_nal_units(AVCodecParserContext *s, const uint8_t *buf,
// sampe_precision(3)
skip_bits(&gb, 47);
- if (profile == AVS3_PROFILE_BASELINE_MAIN10) {
- int sample_precision = get_bits(&gb, 3);
- if (sample_precision == 1) {
+ if (profile == AVS3_PROFILE_BASELINE_MAIN10 || profile == AVS3_PROFILE_BASELINE_HIGH10) {
+ int encoding_precision = get_bits(&gb, 3);
+ if (encoding_precision == 1) {
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
- } else if (sample_precision == 2) {
+ } else if (encoding_precision == 2) {
avctx->pix_fmt = AV_PIX_FMT_YUV420P10LE;
} else {
avctx->pix_fmt = AV_PIX_FMT_NONE;
diff --git a/libavformat/avs3dec.c b/libavformat/avs3dec.c
index 2395df171b..335b5409f5 100644
--- a/libavformat/avs3dec.c
+++ b/libavformat/avs3dec.c
@@ -47,7 +47,7 @@ static int avs3video_probe(const AVProbeData *p)
}
if (state == AVS3_SEQ_START_CODE) {
seq++;
- if (*ptr != AVS3_PROFILE_BASELINE_MAIN && *ptr != AVS3_PROFILE_BASELINE_MAIN10)
+ if (*ptr != AVS3_PROFILE_BASELINE_MAIN && *ptr != AVS3_PROFILE_BASELINE_MAIN10 && *ptr != AVS3_PROFILE_BASELINE_HIGH && *ptr != AVS3_PROFILE_BASELINE_HIGH10)
return 0;
} else if (AVS3_ISPIC(state)) {
pic++;
--
2.30.0.windows.2
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] AVS3: add support for AVS3 High profile - same syntax as AVS3 Main profile
2022-02-26 5:50 [FFmpeg-devel] [PATCH] AVS3: add support for AVS3 High profile - same syntax as AVS3 Main profile Paul Higgs
@ 2022-02-26 7:18 ` lance.lmwang
2022-02-26 7:48 ` Paul Higgs
0 siblings, 1 reply; 4+ messages in thread
From: lance.lmwang @ 2022-02-26 7:18 UTC (permalink / raw)
To: ffmpeg-devel
On Sat, Feb 26, 2022 at 05:50:39AM +0000, Paul Higgs wrote:
> This patch adds high level syntax support for parsing AVS3 High profile bitstreams.
> Latest AVS3 specification including High profile is available at http://www.avs.org.cn/AVS3_download/en_index.asp
>
> Signed-off-by: Paul Higgs <paul_higgs@hotmail.com>
> ---
> libavcodec/avs3.h | 2 ++
> libavcodec/avs3_parser.c | 8 ++++----
> libavformat/avs3dec.c | 2 +-
> 3 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/avs3.h b/libavcodec/avs3.h
> index 4189d9b583..c8caa58b0a 100644
> --- a/libavcodec/avs3.h
> +++ b/libavcodec/avs3.h
> @@ -35,6 +35,8 @@
> #define AVS3_FIRST_SLICE_START_CODE 0x00
> #define AVS3_PROFILE_BASELINE_MAIN 0x20
> #define AVS3_PROFILE_BASELINE_MAIN10 0x22
> +#define AVS3_PROFILE_BASELINE_HIGH 0x30
> +#define AVS3_PROFILE_BASELINE_HIGH10 0x32
>
> #define AVS3_ISPIC(x) ((x) == AVS3_INTRA_PIC_START_CODE || (x) == AVS3_INTER_PIC_START_CODE)
> #define AVS3_ISUNIT(x) ((x) == AVS3_SEQ_START_CODE || AVS3_ISPIC(x))
> diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
> index d04d96a03a..483b38fe76 100644
> --- a/libavcodec/avs3_parser.c
> +++ b/libavcodec/avs3_parser.c
> @@ -91,11 +91,11 @@ static void parse_avs3_nal_units(AVCodecParserContext *s, const uint8_t *buf,
> // sampe_precision(3)
> skip_bits(&gb, 47);
>
> - if (profile == AVS3_PROFILE_BASELINE_MAIN10) {
> - int sample_precision = get_bits(&gb, 3);
> - if (sample_precision == 1) {
> + if (profile == AVS3_PROFILE_BASELINE_MAIN10 || profile == AVS3_PROFILE_BASELINE_HIGH10) {
> + int encoding_precision = get_bits(&gb, 3);
> + if (encoding_precision == 1) {
Please keep sample_precision name, it's unrelated cosmetic change in this patch.
> avctx->pix_fmt = AV_PIX_FMT_YUV420P;
> - } else if (sample_precision == 2) {
> + } else if (encoding_precision == 2) {
> avctx->pix_fmt = AV_PIX_FMT_YUV420P10LE;
> } else {
> avctx->pix_fmt = AV_PIX_FMT_NONE;
> diff --git a/libavformat/avs3dec.c b/libavformat/avs3dec.c
> index 2395df171b..335b5409f5 100644
> --- a/libavformat/avs3dec.c
> +++ b/libavformat/avs3dec.c
> @@ -47,7 +47,7 @@ static int avs3video_probe(const AVProbeData *p)
> }
> if (state == AVS3_SEQ_START_CODE) {
> seq++;
> - if (*ptr != AVS3_PROFILE_BASELINE_MAIN && *ptr != AVS3_PROFILE_BASELINE_MAIN10)
> + if (*ptr != AVS3_PROFILE_BASELINE_MAIN && *ptr != AVS3_PROFILE_BASELINE_MAIN10 && *ptr != AVS3_PROFILE_BASELINE_HIGH && *ptr != AVS3_PROFILE_BASELINE_HIGH10)
The line is too long.
> return 0;
> } else if (AVS3_ISPIC(state)) {
> pic++;
> --
> 2.30.0.windows.2
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
--
Thanks,
Limin Wang
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] AVS3: add support for AVS3 High profile - same syntax as AVS3 Main profile
2022-02-26 7:18 ` lance.lmwang
@ 2022-02-26 7:48 ` Paul Higgs
2022-02-26 12:18 ` lance.lmwang
0 siblings, 1 reply; 4+ messages in thread
From: Paul Higgs @ 2022-02-26 7:48 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> lance.lmwang@gmail.com
> Sent: 26 February 2022 07:18
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH] AVS3: add support for AVS3 High profile
> - same syntax as AVS3 Main profile
>
> On Sat, Feb 26, 2022 at 05:50:39AM +0000, Paul Higgs wrote:
> > This patch adds high level syntax support for parsing AVS3 High profile
> bitstreams.
> > Latest AVS3 specification including High profile is available at
> > http://www.avs.org.cn/AVS3_download/en_index.asp
> >
> > Signed-off-by: Paul Higgs <paul_higgs@hotmail.com>
> > ---
> > libavcodec/avs3.h | 2 ++
> > libavcodec/avs3_parser.c | 8 ++++----
> > libavformat/avs3dec.c | 2 +-
> > 3 files changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/libavcodec/avs3.h b/libavcodec/avs3.h index
> > 4189d9b583..c8caa58b0a 100644
> > --- a/libavcodec/avs3.h
> > +++ b/libavcodec/avs3.h
> > @@ -35,6 +35,8 @@
> > #define AVS3_FIRST_SLICE_START_CODE 0x00
> > #define AVS3_PROFILE_BASELINE_MAIN 0x20
> > #define AVS3_PROFILE_BASELINE_MAIN10 0x22
> > +#define AVS3_PROFILE_BASELINE_HIGH 0x30
> > +#define AVS3_PROFILE_BASELINE_HIGH10 0x32
> >
> > #define AVS3_ISPIC(x) ((x) == AVS3_INTRA_PIC_START_CODE || (x) ==
> > AVS3_INTER_PIC_START_CODE) #define AVS3_ISUNIT(x) ((x) ==
> > AVS3_SEQ_START_CODE || AVS3_ISPIC(x)) diff --git
> > a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c index
> > d04d96a03a..483b38fe76 100644
> > --- a/libavcodec/avs3_parser.c
> > +++ b/libavcodec/avs3_parser.c
> > @@ -91,11 +91,11 @@ static void
> parse_avs3_nal_units(AVCodecParserContext *s, const uint8_t *buf,
> > // sampe_precision(3)
> > skip_bits(&gb, 47);
> >
> > - if (profile == AVS3_PROFILE_BASELINE_MAIN10) {
> > - int sample_precision = get_bits(&gb, 3);
> > - if (sample_precision == 1) {
> > + if (profile == AVS3_PROFILE_BASELINE_MAIN10 || profile ==
> AVS3_PROFILE_BASELINE_HIGH10) {
> > + int encoding_precision = get_bits(&gb, 3);
> > + if (encoding_precision == 1) {
>
> Please keep sample_precision name, it's unrelated cosmetic change in this
> patch.
>
Changed this because the three bits read in get_bits(&gb,3) are for the encoding precision. sample_precision syntax element was
Skipped previously
> > avctx->pix_fmt = AV_PIX_FMT_YUV420P;
> > - } else if (sample_precision == 2) {
> > + } else if (encoding_precision == 2) {
> > avctx->pix_fmt = AV_PIX_FMT_YUV420P10LE;
> > } else {
> > avctx->pix_fmt = AV_PIX_FMT_NONE; diff --git
> > a/libavformat/avs3dec.c b/libavformat/avs3dec.c index
> > 2395df171b..335b5409f5 100644
> > --- a/libavformat/avs3dec.c
> > +++ b/libavformat/avs3dec.c
> > @@ -47,7 +47,7 @@ static int avs3video_probe(const AVProbeData *p)
> > }
> > if (state == AVS3_SEQ_START_CODE) {
> > seq++;
> > - if (*ptr != AVS3_PROFILE_BASELINE_MAIN && *ptr !=
> AVS3_PROFILE_BASELINE_MAIN10)
> > + if (*ptr != AVS3_PROFILE_BASELINE_MAIN && *ptr !=
> > + AVS3_PROFILE_BASELINE_MAIN10 && *ptr !=
> AVS3_PROFILE_BASELINE_HIGH
> > + && *ptr != AVS3_PROFILE_BASELINE_HIGH10)
>
> The line is too long.
Ok, will wrap before 80 characters
>
> > return 0;
> > } else if (AVS3_ISPIC(state)) {
> > pic++;
> > --
> > 2.30.0.windows.2
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
> --
> Thanks,
> Limin Wang
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org
> with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] AVS3: add support for AVS3 High profile - same syntax as AVS3 Main profile
2022-02-26 7:48 ` Paul Higgs
@ 2022-02-26 12:18 ` lance.lmwang
0 siblings, 0 replies; 4+ messages in thread
From: lance.lmwang @ 2022-02-26 12:18 UTC (permalink / raw)
To: ffmpeg-devel
On Sat, Feb 26, 2022 at 07:48:24AM +0000, Paul Higgs wrote:
>
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > lance.lmwang@gmail.com
> > Sent: 26 February 2022 07:18
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH] AVS3: add support for AVS3 High profile
> > - same syntax as AVS3 Main profile
> >
> > On Sat, Feb 26, 2022 at 05:50:39AM +0000, Paul Higgs wrote:
> > > This patch adds high level syntax support for parsing AVS3 High profile
> > bitstreams.
> > > Latest AVS3 specification including High profile is available at
> > > http://www.avs.org.cn/AVS3_download/en_index.asp
> > >
> > > Signed-off-by: Paul Higgs <paul_higgs@hotmail.com>
> > > ---
> > > libavcodec/avs3.h | 2 ++
> > > libavcodec/avs3_parser.c | 8 ++++----
> > > libavformat/avs3dec.c | 2 +-
> > > 3 files changed, 7 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/libavcodec/avs3.h b/libavcodec/avs3.h index
> > > 4189d9b583..c8caa58b0a 100644
> > > --- a/libavcodec/avs3.h
> > > +++ b/libavcodec/avs3.h
> > > @@ -35,6 +35,8 @@
> > > #define AVS3_FIRST_SLICE_START_CODE 0x00
> > > #define AVS3_PROFILE_BASELINE_MAIN 0x20
> > > #define AVS3_PROFILE_BASELINE_MAIN10 0x22
> > > +#define AVS3_PROFILE_BASELINE_HIGH 0x30
> > > +#define AVS3_PROFILE_BASELINE_HIGH10 0x32
> > >
> > > #define AVS3_ISPIC(x) ((x) == AVS3_INTRA_PIC_START_CODE || (x) ==
> > > AVS3_INTER_PIC_START_CODE) #define AVS3_ISUNIT(x) ((x) ==
> > > AVS3_SEQ_START_CODE || AVS3_ISPIC(x)) diff --git
> > > a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c index
> > > d04d96a03a..483b38fe76 100644
> > > --- a/libavcodec/avs3_parser.c
> > > +++ b/libavcodec/avs3_parser.c
> > > @@ -91,11 +91,11 @@ static void
> > parse_avs3_nal_units(AVCodecParserContext *s, const uint8_t *buf,
> > > // sampe_precision(3)
> > > skip_bits(&gb, 47);
> > >
> > > - if (profile == AVS3_PROFILE_BASELINE_MAIN10) {
> > > - int sample_precision = get_bits(&gb, 3);
> > > - if (sample_precision == 1) {
> > > + if (profile == AVS3_PROFILE_BASELINE_MAIN10 || profile ==
> > AVS3_PROFILE_BASELINE_HIGH10) {
> > > + int encoding_precision = get_bits(&gb, 3);
> > > + if (encoding_precision == 1) {
> >
> > Please keep sample_precision name, it's unrelated cosmetic change in this
> > patch.
> >
> Changed this because the three bits read in get_bits(&gb,3) are for the encoding precision. sample_precision syntax element was
> Skipped previously
then I think it's better to fix this in another patch instead of mixed changed.
> > > avctx->pix_fmt = AV_PIX_FMT_YUV420P;
> > > - } else if (sample_precision == 2) {
> > > + } else if (encoding_precision == 2) {
> > > avctx->pix_fmt = AV_PIX_FMT_YUV420P10LE;
> > > } else {
> > > avctx->pix_fmt = AV_PIX_FMT_NONE; diff --git
> > > a/libavformat/avs3dec.c b/libavformat/avs3dec.c index
> > > 2395df171b..335b5409f5 100644
> > > --- a/libavformat/avs3dec.c
> > > +++ b/libavformat/avs3dec.c
> > > @@ -47,7 +47,7 @@ static int avs3video_probe(const AVProbeData *p)
> > > }
> > > if (state == AVS3_SEQ_START_CODE) {
> > > seq++;
> > > - if (*ptr != AVS3_PROFILE_BASELINE_MAIN && *ptr !=
> > AVS3_PROFILE_BASELINE_MAIN10)
> > > + if (*ptr != AVS3_PROFILE_BASELINE_MAIN && *ptr !=
> > > + AVS3_PROFILE_BASELINE_MAIN10 && *ptr !=
> > AVS3_PROFILE_BASELINE_HIGH
> > > + && *ptr != AVS3_PROFILE_BASELINE_HIGH10)
> >
> > The line is too long.
> Ok, will wrap before 80 characters
> >
> > > return 0;
> > > } else if (AVS3_ISPIC(state)) {
> > > pic++;
> > > --
> > > 2.30.0.windows.2
> > >
> > > _______________________________________________
> > > ffmpeg-devel mailing list
> > > ffmpeg-devel@ffmpeg.org
> > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > >
> > > To unsubscribe, visit link above, or email
> > > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> >
> > --
> > Thanks,
> > Limin Wang
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org
> > with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
--
Thanks,
Limin Wang
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-26 12:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-26 5:50 [FFmpeg-devel] [PATCH] AVS3: add support for AVS3 High profile - same syntax as AVS3 Main profile Paul Higgs
2022-02-26 7:18 ` lance.lmwang
2022-02-26 7:48 ` Paul Higgs
2022-02-26 12:18 ` lance.lmwang
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git