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

* [FFmpeg-devel] [PATCH 2/2] fate/h264: add test case for h264-loss_packet_for_prev_frame_num_offset
  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 ` Steven Liu
  2022-02-16  8:54   ` 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: Steven Liu

From: Steven Liu <liuqi05@kuaishou.com>

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
---
 tests/fate/h264.mak                           |  2 ++
 ...h264-loss_packet_for_prev_frame_num_offset | 23 +++++++++++++++++++
 2 files changed, 25 insertions(+)
 create mode 100644 tests/ref/fate/h264-loss_packet_for_prev_frame_num_offset

diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak
index e075b6f67f..142a4ea708 100644
--- a/tests/fate/h264.mak
+++ b/tests/fate/h264.mak
@@ -195,6 +195,7 @@ FATE_H264  := $(FATE_H264:%=fate-h264-conformance-%)                    \
               fate-h264-lossless                                        \
               fate-h264-3386                                            \
               fate-h264-missing-frame                                   \
+              fate-h264-loss_packet_for_prev_frame_num_offset           \
               fate-h264-ref-pic-mod-overflow                            \
               fate-h264-timecode                                        \
               fate-h264-encparams
@@ -442,6 +443,7 @@ fate-h264-twofields-packet:                       CMD = framecrc -i $(TARGET_SAM
 fate-h264-unescaped-extradata:                    CMD = framecrc -i $(TARGET_SAMPLES)/h264/unescaped_extradata.mp4 -an -frames 10
 fate-h264-3386:                                   CMD = framecrc -i $(TARGET_SAMPLES)/h264/bbc2.sample.h264
 fate-h264-missing-frame:                          CMD = framecrc -i $(TARGET_SAMPLES)/h264/nondeterministic_cut.h264
+fate-h264-loss_packet_for_prev_frame_num_offset:  CMD = framecrc -i $(TARGET_SAMPLES)/h264/loss_packet_for_prev_frame_num_offset.h264
 fate-h264-timecode:                               CMD = framecrc -i $(TARGET_SAMPLES)/h264/crew_cif_timecode-2.h264
 
 fate-h264-reinit-%:                               CMD = framecrc -i $(TARGET_SAMPLES)/h264/$(@:fate-h264-%=%).h264 -vf scale,format=yuv444p10le,scale=w=352:h=288
diff --git a/tests/ref/fate/h264-loss_packet_for_prev_frame_num_offset b/tests/ref/fate/h264-loss_packet_for_prev_frame_num_offset
new file mode 100644
index 0000000000..df8a88f5d4
--- /dev/null
+++ b/tests/ref/fate/h264-loss_packet_for_prev_frame_num_offset
@@ -0,0 +1,23 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 1280x720
+#sar 0: 0/1
+0,          0,          0,        1,  1382400, 0xa21b9a12
+0,          1,          1,        1,  1382400, 0x9f266c66
+0,          2,          2,        1,  1382400, 0x08604d2c
+0,          3,          3,        1,  1382400, 0x0f59c63a
+0,          4,          4,        1,  1382400, 0xe9588c5d
+0,          5,          5,        1,  1382400, 0x01c3559a
+0,          6,          6,        1,  1382400, 0x40791f04
+0,          7,          7,        1,  1382400, 0x2047c562
+0,          8,          8,        1,  1382400, 0x24f7b450
+0,          9,          9,        1,  1382400, 0xfa3d00ed
+0,         10,         10,        1,  1382400, 0x8c3384ed
+0,         11,         11,        1,  1382400, 0xfa7c59e0
+0,         12,         12,        1,  1382400, 0x0d16c5d1
+0,         13,         13,        1,  1382400, 0x665bd32c
+0,         14,         14,        1,  1382400, 0xe8771b9d
+0,         15,         15,        1,  1382400, 0xd9824ab1
+0,         16,         16,        1,  1382400, 0xa7264481
+0,         17,         17,        1,  1382400, 0xdcaec99a
-- 
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

* Re: [FFmpeg-devel] [PATCH 2/2] fate/h264: add test case for h264-loss_packet_for_prev_frame_num_offset
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Liu @ 2022-02-16  8:54 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Steven Liu, Steven Liu

[-- Attachment #1: Type: text/plain, Size: 3925 bytes --]



> 2022年2月16日 下午4:51,Steven Liu <lq@chinaffmpeg.org> 写道:
> 
> From: Steven Liu <liuqi05@kuaishou.com>
> 
> Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
> ---
> tests/fate/h264.mak                           |  2 ++
> ...h264-loss_packet_for_prev_frame_num_offset | 23 +++++++++++++++++++
> 2 files changed, 25 insertions(+)
> create mode 100644 tests/ref/fate/h264-loss_packet_for_prev_frame_num_offset
> 
> diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak
> index e075b6f67f..142a4ea708 100644
> --- a/tests/fate/h264.mak
> +++ b/tests/fate/h264.mak
> @@ -195,6 +195,7 @@ FATE_H264  := $(FATE_H264:%=fate-h264-conformance-%)                    \
>               fate-h264-lossless                                        \
>               fate-h264-3386                                            \
>               fate-h264-missing-frame                                   \
> +              fate-h264-loss_packet_for_prev_frame_num_offset           \
>               fate-h264-ref-pic-mod-overflow                            \
>               fate-h264-timecode                                        \
>               fate-h264-encparams
> @@ -442,6 +443,7 @@ fate-h264-twofields-packet:                       CMD = framecrc -i $(TARGET_SAM
> fate-h264-unescaped-extradata:                    CMD = framecrc -i $(TARGET_SAMPLES)/h264/unescaped_extradata.mp4 -an -frames 10
> fate-h264-3386:                                   CMD = framecrc -i $(TARGET_SAMPLES)/h264/bbc2.sample.h264
> fate-h264-missing-frame:                          CMD = framecrc -i $(TARGET_SAMPLES)/h264/nondeterministic_cut.h264
> +fate-h264-loss_packet_for_prev_frame_num_offset:  CMD = framecrc -i $(TARGET_SAMPLES)/h264/loss_packet_for_prev_frame_num_offset.h264
> fate-h264-timecode:                               CMD = framecrc -i $(TARGET_SAMPLES)/h264/crew_cif_timecode-2.h264
> 
> fate-h264-reinit-%:                               CMD = framecrc -i $(TARGET_SAMPLES)/h264/$(@:fate-h264-%=%).h264 -vf scale,format=yuv444p10le,scale=w=352:h=288
> diff --git a/tests/ref/fate/h264-loss_packet_for_prev_frame_num_offset b/tests/ref/fate/h264-loss_packet_for_prev_frame_num_offset
> new file mode 100644
> index 0000000000..df8a88f5d4
> --- /dev/null
> +++ b/tests/ref/fate/h264-loss_packet_for_prev_frame_num_offset
> @@ -0,0 +1,23 @@
> +#tb 0: 1/25
> +#media_type 0: video
> +#codec_id 0: rawvideo
> +#dimensions 0: 1280x720
> +#sar 0: 0/1
> +0,          0,          0,        1,  1382400, 0xa21b9a12
> +0,          1,          1,        1,  1382400, 0x9f266c66
> +0,          2,          2,        1,  1382400, 0x08604d2c
> +0,          3,          3,        1,  1382400, 0x0f59c63a
> +0,          4,          4,        1,  1382400, 0xe9588c5d
> +0,          5,          5,        1,  1382400, 0x01c3559a
> +0,          6,          6,        1,  1382400, 0x40791f04
> +0,          7,          7,        1,  1382400, 0x2047c562
> +0,          8,          8,        1,  1382400, 0x24f7b450
> +0,          9,          9,        1,  1382400, 0xfa3d00ed
> +0,         10,         10,        1,  1382400, 0x8c3384ed
> +0,         11,         11,        1,  1382400, 0xfa7c59e0
> +0,         12,         12,        1,  1382400, 0x0d16c5d1
> +0,         13,         13,        1,  1382400, 0x665bd32c
> +0,         14,         14,        1,  1382400, 0xe8771b9d
> +0,         15,         15,        1,  1382400, 0xd9824ab1
> +0,         16,         16,        1,  1382400, 0xa7264481
> +0,         17,         17,        1,  1382400, 0xdcaec99a
> -- 
> 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".
> 

attach test file

[-- Attachment #2: loss_packet_for_prev_frame_num_offset.h264 --]
[-- Type: application/octet-stream, Size: 82085 bytes --]

[-- Attachment #3: Type: text/plain, Size: 21 bytes --]


Thanks

Steven Liu


[-- Attachment #4: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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 2/2] fate/h264: add test case for h264-loss_packet_for_prev_frame_num_offset
  2022-02-16  8:54   ` Steven Liu
@ 2022-03-21  6:43     ` Steven Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Steven Liu @ 2022-03-21  6:43 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Steven Liu



> 2022年2月16日 下午4:54,Steven Liu <lq@chinaffmpeg.org> 写道:
> 
> 
> 
>> 2022年2月16日 下午4:51,Steven Liu <lq@chinaffmpeg.org> 写道:
>> 
>> From: Steven Liu <liuqi05@kuaishou.com>
>> 
>> Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
>> ---
>> tests/fate/h264.mak                           |  2 ++
>> ...h264-loss_packet_for_prev_frame_num_offset | 23 +++++++++++++++++++
>> 2 files changed, 25 insertions(+)
>> create mode 100644 tests/ref/fate/h264-loss_packet_for_prev_frame_num_offset
>> 
>> diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak
>> index e075b6f67f..142a4ea708 100644
>> --- a/tests/fate/h264.mak
>> +++ b/tests/fate/h264.mak
>> @@ -195,6 +195,7 @@ FATE_H264  := $(FATE_H264:%=fate-h264-conformance-%)                    \
>>              fate-h264-lossless                                        \
>>              fate-h264-3386                                            \
>>              fate-h264-missing-frame                                   \
>> +              fate-h264-loss_packet_for_prev_frame_num_offset           \
>>              fate-h264-ref-pic-mod-overflow                            \
>>              fate-h264-timecode                                        \
>>              fate-h264-encparams
>> @@ -442,6 +443,7 @@ fate-h264-twofields-packet:                       CMD = framecrc -i $(TARGET_SAM
>> fate-h264-unescaped-extradata:                    CMD = framecrc -i $(TARGET_SAMPLES)/h264/unescaped_extradata.mp4 -an -frames 10
>> fate-h264-3386:                                   CMD = framecrc -i $(TARGET_SAMPLES)/h264/bbc2.sample.h264
>> fate-h264-missing-frame:                          CMD = framecrc -i $(TARGET_SAMPLES)/h264/nondeterministic_cut.h264
>> +fate-h264-loss_packet_for_prev_frame_num_offset:  CMD = framecrc -i $(TARGET_SAMPLES)/h264/loss_packet_for_prev_frame_num_offset.h264
>> fate-h264-timecode:                               CMD = framecrc -i $(TARGET_SAMPLES)/h264/crew_cif_timecode-2.h264
>> 
>> fate-h264-reinit-%:                               CMD = framecrc -i $(TARGET_SAMPLES)/h264/$(@:fate-h264-%=%).h264 -vf scale,format=yuv444p10le,scale=w=352:h=288
>> diff --git a/tests/ref/fate/h264-loss_packet_for_prev_frame_num_offset b/tests/ref/fate/h264-loss_packet_for_prev_frame_num_offset
>> new file mode 100644
>> index 0000000000..df8a88f5d4
>> --- /dev/null
>> +++ b/tests/ref/fate/h264-loss_packet_for_prev_frame_num_offset
>> @@ -0,0 +1,23 @@
>> +#tb 0: 1/25
>> +#media_type 0: video
>> +#codec_id 0: rawvideo
>> +#dimensions 0: 1280x720
>> +#sar 0: 0/1
>> +0,          0,          0,        1,  1382400, 0xa21b9a12
>> +0,          1,          1,        1,  1382400, 0x9f266c66
>> +0,          2,          2,        1,  1382400, 0x08604d2c
>> +0,          3,          3,        1,  1382400, 0x0f59c63a
>> +0,          4,          4,        1,  1382400, 0xe9588c5d
>> +0,          5,          5,        1,  1382400, 0x01c3559a
>> +0,          6,          6,        1,  1382400, 0x40791f04
>> +0,          7,          7,        1,  1382400, 0x2047c562
>> +0,          8,          8,        1,  1382400, 0x24f7b450
>> +0,          9,          9,        1,  1382400, 0xfa3d00ed
>> +0,         10,         10,        1,  1382400, 0x8c3384ed
>> +0,         11,         11,        1,  1382400, 0xfa7c59e0
>> +0,         12,         12,        1,  1382400, 0x0d16c5d1
>> +0,         13,         13,        1,  1382400, 0x665bd32c
>> +0,         14,         14,        1,  1382400, 0xe8771b9d
>> +0,         15,         15,        1,  1382400, 0xd9824ab1
>> +0,         16,         16,        1,  1382400, 0xa7264481
>> +0,         17,         17,        1,  1382400, 0xdcaec99a
>> -- 
>> 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".
>> 
> 
> attach test file
> <loss_packet_for_prev_frame_num_offset.h264>
ping

> Thanks
> 
> Steven Liu
> 

Thanks

Steven Liu

_______________________________________________
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