* [FFmpeg-devel] [PATCH 1/3] avcodec/avs3_parser: set has_b_frames properly
@ 2022-05-13 9:40 Zhao Zhili
2022-05-13 9:43 ` Andreas Rheinhardt
0 siblings, 1 reply; 5+ messages in thread
From: Zhao Zhili @ 2022-05-13 9:40 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
has_b_frames should be output_reorder_delay field in AVS3 sequence
header and larger than 1. The parser implementation doesn't parse
that field. Decoder can set has_b_frames properly, so use FFMAX
here to avoid resetting has_b_frames from output_reorder_delay to 1.
---
libavcodec/avs3_parser.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
index d04d96a03a..0d2e940d1e 100644
--- a/libavcodec/avs3_parser.c
+++ b/libavcodec/avs3_parser.c
@@ -114,7 +114,7 @@ static void parse_avs3_nal_units(AVCodecParserContext *s, const uint8_t *buf,
// bitrate_high(12)
skip_bits(&gb, 32);
- avctx->has_b_frames = !get_bits(&gb, 1);
+ avctx->has_b_frames = FFMAX(avctx->has_b_frames, !get_bits(&gb, 1));
avctx->framerate.num = avctx->time_base.den = ff_avs3_frame_rate_tab[ratecode].num;
avctx->framerate.den = avctx->time_base.num = ff_avs3_frame_rate_tab[ratecode].den;
--
2.35.3
_______________________________________________
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] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/3] avcodec/avs3_parser: set has_b_frames properly
2022-05-13 9:40 [FFmpeg-devel] [PATCH 1/3] avcodec/avs3_parser: set has_b_frames properly Zhao Zhili
@ 2022-05-13 9:43 ` Andreas Rheinhardt
2022-05-13 10:12 ` [FFmpeg-devel] [PATCH v2 " Zhao Zhili
2022-05-13 10:15 ` [FFmpeg-devel] [PATCH " "zhilizhao(赵志立)"
0 siblings, 2 replies; 5+ messages in thread
From: Andreas Rheinhardt @ 2022-05-13 9:43 UTC (permalink / raw)
To: ffmpeg-devel
Zhao Zhili:
> has_b_frames should be output_reorder_delay field in AVS3 sequence
> header and larger than 1. The parser implementation doesn't parse
> that field. Decoder can set has_b_frames properly, so use FFMAX
> here to avoid resetting has_b_frames from output_reorder_delay to 1.
> ---
> libavcodec/avs3_parser.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
> index d04d96a03a..0d2e940d1e 100644
> --- a/libavcodec/avs3_parser.c
> +++ b/libavcodec/avs3_parser.c
> @@ -114,7 +114,7 @@ static void parse_avs3_nal_units(AVCodecParserContext *s, const uint8_t *buf,
> // bitrate_high(12)
> skip_bits(&gb, 32);
>
> - avctx->has_b_frames = !get_bits(&gb, 1);
> + avctx->has_b_frames = FFMAX(avctx->has_b_frames, !get_bits(&gb, 1));
>
> avctx->framerate.num = avctx->time_base.den = ff_avs3_frame_rate_tab[ratecode].num;
> avctx->framerate.den = avctx->time_base.num = ff_avs3_frame_rate_tab[ratecode].den;
FFMAX can evaluate its arguments more than once which is not intended here.
- Andreas
_______________________________________________
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] 5+ messages in thread
* [FFmpeg-devel] [PATCH v2 1/3] avcodec/avs3_parser: set has_b_frames properly
2022-05-13 9:43 ` Andreas Rheinhardt
@ 2022-05-13 10:12 ` Zhao Zhili
2022-05-23 3:26 ` "zhilizhao(赵志立)"
2022-05-13 10:15 ` [FFmpeg-devel] [PATCH " "zhilizhao(赵志立)"
1 sibling, 1 reply; 5+ messages in thread
From: Zhao Zhili @ 2022-05-13 10:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
has_b_frames should be output_reorder_delay field in AVS3 sequence
header and larger than 1. The parser implementation doesn't parse
that field. Decoder can set has_b_frames properly, so use FFMAX
here to avoid resetting has_b_frames from output_reorder_delay to 1.
---
libavcodec/avs3_parser.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
index d04d96a03a..a9fd879e9d 100644
--- a/libavcodec/avs3_parser.c
+++ b/libavcodec/avs3_parser.c
@@ -71,7 +71,7 @@ static void parse_avs3_nal_units(AVCodecParserContext *s, const uint8_t *buf,
if (buf[0] == 0x0 && buf[1] == 0x0 && buf[2] == 0x1) {
if (buf[3] == AVS3_SEQ_START_CODE) {
GetBitContext gb;
- int profile, ratecode;
+ int profile, ratecode, low_delay;
init_get_bits8(&gb, buf + 4, buf_size - 4);
@@ -114,7 +114,8 @@ static void parse_avs3_nal_units(AVCodecParserContext *s, const uint8_t *buf,
// bitrate_high(12)
skip_bits(&gb, 32);
- avctx->has_b_frames = !get_bits(&gb, 1);
+ low_delay = get_bits(&gb, 1);
+ avctx->has_b_frames = FFMAX(avctx->has_b_frames, !low_delay);
avctx->framerate.num = avctx->time_base.den = ff_avs3_frame_rate_tab[ratecode].num;
avctx->framerate.den = avctx->time_base.num = ff_avs3_frame_rate_tab[ratecode].den;
--
2.35.3
_______________________________________________
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] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/3] avcodec/avs3_parser: set has_b_frames properly
2022-05-13 9:43 ` Andreas Rheinhardt
2022-05-13 10:12 ` [FFmpeg-devel] [PATCH v2 " Zhao Zhili
@ 2022-05-13 10:15 ` "zhilizhao(赵志立)"
1 sibling, 0 replies; 5+ messages in thread
From: "zhilizhao(赵志立)" @ 2022-05-13 10:15 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> On May 13, 2022, at 5:43 PM, Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote:
>
> Zhao Zhili:
>> has_b_frames should be output_reorder_delay field in AVS3 sequence
>> header and larger than 1. The parser implementation doesn't parse
>> that field. Decoder can set has_b_frames properly, so use FFMAX
>> here to avoid resetting has_b_frames from output_reorder_delay to 1.
>> ---
>> libavcodec/avs3_parser.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
>> index d04d96a03a..0d2e940d1e 100644
>> --- a/libavcodec/avs3_parser.c
>> +++ b/libavcodec/avs3_parser.c
>> @@ -114,7 +114,7 @@ static void parse_avs3_nal_units(AVCodecParserContext *s, const uint8_t *buf,
>> // bitrate_high(12)
>> skip_bits(&gb, 32);
>>
>> - avctx->has_b_frames = !get_bits(&gb, 1);
>> + avctx->has_b_frames = FFMAX(avctx->has_b_frames, !get_bits(&gb, 1));
>>
>> avctx->framerate.num = avctx->time_base.den = ff_avs3_frame_rate_tab[ratecode].num;
>> avctx->framerate.den = avctx->time_base.num = ff_avs3_frame_rate_tab[ratecode].den;
>
> FFMAX can evaluate its arguments more than once which is not intended here.
Good catch, thanks! Here is v2:
http://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/296396.html
Use a variable low_delay to fix the FFMAX issue and serve as document.
>
> - Andreas
> _______________________________________________
> 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] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 1/3] avcodec/avs3_parser: set has_b_frames properly
2022-05-13 10:12 ` [FFmpeg-devel] [PATCH v2 " Zhao Zhili
@ 2022-05-23 3:26 ` "zhilizhao(赵志立)"
0 siblings, 0 replies; 5+ messages in thread
From: "zhilizhao(赵志立)" @ 2022-05-23 3:26 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> On May 13, 2022, at 6:12 PM, Zhao Zhili <quinkblack@foxmail.com> wrote:
>
> has_b_frames should be output_reorder_delay field in AVS3 sequence
> header and larger than 1. The parser implementation doesn't parse
> that field. Decoder can set has_b_frames properly, so use FFMAX
> here to avoid resetting has_b_frames from output_reorder_delay to 1.
> ---
> libavcodec/avs3_parser.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
> index d04d96a03a..a9fd879e9d 100644
> --- a/libavcodec/avs3_parser.c
> +++ b/libavcodec/avs3_parser.c
> @@ -71,7 +71,7 @@ static void parse_avs3_nal_units(AVCodecParserContext *s, const uint8_t *buf,
> if (buf[0] == 0x0 && buf[1] == 0x0 && buf[2] == 0x1) {
> if (buf[3] == AVS3_SEQ_START_CODE) {
> GetBitContext gb;
> - int profile, ratecode;
> + int profile, ratecode, low_delay;
>
> init_get_bits8(&gb, buf + 4, buf_size - 4);
>
> @@ -114,7 +114,8 @@ static void parse_avs3_nal_units(AVCodecParserContext *s, const uint8_t *buf,
> // bitrate_high(12)
> skip_bits(&gb, 32);
>
> - avctx->has_b_frames = !get_bits(&gb, 1);
> + low_delay = get_bits(&gb, 1);
> + avctx->has_b_frames = FFMAX(avctx->has_b_frames, !low_delay);
>
> avctx->framerate.num = avctx->time_base.den = ff_avs3_frame_rate_tab[ratecode].num;
> avctx->framerate.den = avctx->time_base.num = ff_avs3_frame_rate_tab[ratecode].den;
> --
> 2.35.3
>
Will apply this patchset tomorrow unless there are objections.
_______________________________________________
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] 5+ messages in thread
end of thread, other threads:[~2022-05-23 3:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13 9:40 [FFmpeg-devel] [PATCH 1/3] avcodec/avs3_parser: set has_b_frames properly Zhao Zhili
2022-05-13 9:43 ` Andreas Rheinhardt
2022-05-13 10:12 ` [FFmpeg-devel] [PATCH v2 " Zhao Zhili
2022-05-23 3:26 ` "zhilizhao(赵志立)"
2022-05-13 10:15 ` [FFmpeg-devel] [PATCH " "zhilizhao(赵志立)"
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