Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/2] avcodec/h264_slice: compute prev_frame_num_offset to correct value
@ 2022-02-16  8:51 Steven Liu
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Liu @ 2022-02-16  8:51 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Shitao Wang, Steven Liu

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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-21  6:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16  8:51 [FFmpeg-devel] [PATCH 1/2] avcodec/h264_slice: compute prev_frame_num_offset to correct value Steven Liu
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

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