From: Steven Liu <lq@chinaffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Shitao Wang <wangshitao@kuaishou.com>, Steven Liu <liuqi05@kuaishou.com>
Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/h264_slice: compute prev_frame_num_offset to correct value
Date: Wed, 16 Feb 2022 16:51:45 +0800
Message-ID: <20220216085146.26078-1-lq@chinaffmpeg.org> (raw)
From: Shitao Wang <wangshitao@kuaishou.com>
If H.264 stream decode under loss packet transport network, h264_slice
will process prev_frame_num_offset in wrong way, it will dup picture,
This is different to JM, so compute the prev_frame_num_offset when
prev_frame_num >= (1 << sps->log2_max_frame_num), then it will
same as JM.
Signed-off-by: Shitao Wang <wangshitao@kuaishou.com>
Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
---
libavcodec/h264_slice.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 110a41772a..6f21c48b2d 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1667,6 +1667,8 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
}
h->poc.prev_frame_num++;
+ if (h->poc.prev_frame_num >= (1 << sps->log2_max_frame_num))
+ h->poc.prev_frame_num_offset += 1 << sps->log2_max_frame_num;
h->poc.prev_frame_num %= 1 << sps->log2_max_frame_num;
h->cur_pic_ptr->frame_num = h->poc.prev_frame_num;
h->cur_pic_ptr->invalid_gap = !sps->gaps_in_frame_num_allowed_flag;
--
2.25.0
_______________________________________________
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".
next reply other threads:[~2022-02-16 8:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-16 8:51 Steven Liu [this message]
2022-02-16 8:51 ` [FFmpeg-devel] [PATCH 2/2] fate/h264: add test case for h264-loss_packet_for_prev_frame_num_offset Steven Liu
2022-02-16 8:54 ` Steven Liu
2022-03-21 6:43 ` Steven Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220216085146.26078-1-lq@chinaffmpeg.org \
--to=lq@chinaffmpeg.org \
--cc=ffmpeg-devel@ffmpeg.org \
--cc=liuqi05@kuaishou.com \
--cc=wangshitao@kuaishou.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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