diff mbox series

[FFmpeg-devel] avcodec/er: remove check for fields

Message ID 20230323091829.34057-1-jdek@itanimul.li
State Accepted
Commit f7abe92bd7939b6aeeb2393fe141033e733305d4
Headers show
Series [FFmpeg-devel] avcodec/er: remove check for fields | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed

Commit Message

J. Dekker March 23, 2023, 9:18 a.m. UTC
This change on its own is almost certainly not correct; however, in
testing many samples show notable improvement.
---

 The warning spams a bit when decoding using due to there being multiple
 ERContexts used but it doesn't seem that excessive and it will be
 removed soon (hopefully).

 libavcodec/error_resilience.c | 9 +++++++--
 libavcodec/error_resilience.h | 1 +
 2 files changed, 8 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer March 23, 2023, 10:05 a.m. UTC | #1
On Thu, Mar 23, 2023 at 10:18:29AM +0100, J. Dekker wrote:
> This change on its own is almost certainly not correct; however, in
> testing many samples show notable improvement.
> ---

do you plan to implement support for field based error concealment ?
field based content was rare in what i watched when i wrote this so
i didnt bother originally implementing it IIRC

thx

[...]
J. Dekker March 23, 2023, 11:15 a.m. UTC | #2
On 23 Mar 2023, at 11:05, Michael Niedermayer wrote:
> On Thu, Mar 23, 2023 at 10:18:29AM +0100, J. Dekker wrote:
>> This change on its own is almost certainly not correct; however, in
>> testing many samples show notable improvement.
>> ---
>
> do you plan to implement support for field based error concealment ?
> field based content was rare in what i watched when i wrote this so
> i didnt bother originally implementing it IIRC

I can send you interlaced samples if you would like. I had planned on doing improvements for field/mbaff error concealment myself in the future. There still seems to be a lot of field based content in the wild whilst it is being phased out.

Here's the comparison of the change above:
https://0x1.st/f0.mp4
https://0x1.st/fe.mp4
https://0x1.st/fZ.mp4
https://0x1.st/fv.mp4
Michael Niedermayer March 23, 2023, 11:55 a.m. UTC | #3
On Thu, Mar 23, 2023 at 12:15:04PM +0100, J. Dekker wrote:
> On 23 Mar 2023, at 11:05, Michael Niedermayer wrote:
> > On Thu, Mar 23, 2023 at 10:18:29AM +0100, J. Dekker wrote:
> >> This change on its own is almost certainly not correct; however, in
> >> testing many samples show notable improvement.
> >> ---
> >
> > do you plan to implement support for field based error concealment ?
> > field based content was rare in what i watched when i wrote this so
> > i didnt bother originally implementing it IIRC
> 
> I can send you interlaced samples if you would like. I had planned on doing improvements for field/mbaff error concealment myself in the future. There still seems to be a lot of field based content in the wild whilst it is being phased out.

no, iam quite happy if you work on this. i have way more things i want
to work on than what i am able to

thx

[...]
J. Dekker March 27, 2023, 6:56 a.m. UTC | #4
On 23 Mar 2023, at 10:18, J. Dekker wrote:

> This change on its own is almost certainly not correct; however, in
> testing many samples show notable improvement.
> ---
>
>  The warning spams a bit when decoding using due to there being multiple
>  ERContexts used but it doesn't seem that excessive and it will be
>  removed soon (hopefully).
>
>  libavcodec/error_resilience.c | 9 +++++++--
>  libavcodec/error_resilience.h | 1 +
>  2 files changed, 8 insertions(+), 2 deletions(-)
>

Pushed.
Michael Niedermayer April 2, 2023, 11:53 p.m. UTC | #5
On Mon, Mar 27, 2023 at 08:56:43AM +0200, J. Dekker wrote:
> On 23 Mar 2023, at 10:18, J. Dekker wrote:
> 
> > This change on its own is almost certainly not correct; however, in
> > testing many samples show notable improvement.
> > ---
> >
> >  The warning spams a bit when decoding using due to there being multiple
> >  ERContexts used but it doesn't seem that excessive and it will be
> >  removed soon (hopefully).
> >
> >  libavcodec/error_resilience.c | 9 +++++++--
> >  libavcodec/error_resilience.h | 1 +
> >  2 files changed, 8 insertions(+), 2 deletions(-)
> >
> 
> Pushed.

why was this pushed ?
the commit even says "This change on its own is almost certainly not correct;"

and in fact after this commit out of array reads and writes occurr

heres an example:
ffmpeg   -y -i  fate-suite/mpeg2/mpeg2_field_encoding.ts -i fate-suite/real/rv30.rm -r 30000/1001 -c:v:1 mpeg4 -map 0:0 -map 1:1 -c:v:0 mpeg2video test.avi

[mpeg2video @ 0x2d084040] Warning MVs not available
[mpeg2video @ 0x2d084040] concealing 90 DC, 90 AC, 90 MV errors in P frame
==15798== Invalid read of size 8
==15798==    at 0xD81A2A: ??? (in ffmpeg_g)
==15798==  Address 0x6071bc48 is 8 bytes inside a block of size 24 free'd
==15798==    at 0x4C32D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x116332A: av_buffer_unref (in ffmpeg_g)
==15798==    by 0x116F5B5: av_frame_unref (in ffmpeg_g)
==15798==    by 0xFFC690: ff_mpeg_unref_picture (in ffmpeg_g)
==15798==    by 0xA340B5: ff_mpv_frame_start (in ffmpeg_g)
==15798==    by 0x9FC981: decode_chunks (in ffmpeg_g)
==15798==    by 0x9FD024: mpeg_decode_frame (in ffmpeg_g)
==15798==    by 0x8316BE: decode_receive_frame_internal (in ffmpeg_g)
==15798==    by 0x83226F: avcodec_send_packet (in ffmpeg_g)
==15798==    by 0x31B10B: decode_video (in ffmpeg_g)
==15798==    by 0x31D048: transcode (in ffmpeg_g)
==15798==    by 0x2EF743: main (in ffmpeg_g)
==15798==  Block was alloc'd at
==15798==    at 0x4C33E76: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x4C33F91: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x117D232: av_malloc (in ffmpeg_g)
==15798==    by 0x117D3E8: av_mallocz (in ffmpeg_g)
==15798==    by 0x11631C7: av_buffer_create (in ffmpeg_g)
==15798==    by 0x8338CC: ff_attach_decode_data (in ffmpeg_g)
==15798==    by 0x833AE4: ff_get_buffer (in ffmpeg_g)
==15798==    by 0xFFC832: ff_alloc_picture (in ffmpeg_g)
==15798==    by 0xA34257: ff_mpv_frame_start (in ffmpeg_g)
==15798==    by 0x9FC981: decode_chunks (in ffmpeg_g)
==15798==    by 0x9FD024: mpeg_decode_frame (in ffmpeg_g)
==15798==    by 0x8316BE: decode_receive_frame_internal (in ffmpeg_g)
==15798==    by 0x83226F: avcodec_send_packet (in ffmpeg_g)
==15798==    by 0x31B10B: decode_video (in ffmpeg_g)
==15798==    by 0x31D048: transcode (in ffmpeg_g)
==15798==    by 0x2EF743: main (in ffmpeg_g)
==15798== 
==15798== Invalid read of size 8
==15798==    at 0xD81A30: ??? (in ffmpeg_g)
==15798==  Address 0x6071bf48 is 584 bytes inside a block of size 1,658 free'd
==15798==    at 0x4C32D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x116333E: av_buffer_unref (in ffmpeg_g)
==15798==    by 0x1163675: av_buffer_replace (in ffmpeg_g)
==15798==    by 0xFFCEA0: ff_update_picture_tables (in ffmpeg_g)
==15798==    by 0xFFD01A: ff_mpeg_ref_picture (in ffmpeg_g)
==15798==    by 0xA34384: ff_mpv_frame_start (in ffmpeg_g)
==15798==    by 0x9FC981: decode_chunks (in ffmpeg_g)
==15798==    by 0x9FD024: mpeg_decode_frame (in ffmpeg_g)
==15798==    by 0x8316BE: decode_receive_frame_internal (in ffmpeg_g)
==15798==    by 0x83226F: avcodec_send_packet (in ffmpeg_g)
==15798==    by 0x31B10B: decode_video (in ffmpeg_g)
==15798==    by 0x31D048: transcode (in ffmpeg_g)
==15798==    by 0x2EF743: main (in ffmpeg_g)
==15798==  Block was alloc'd at
==15798==    at 0x4C33E76: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x4C33F91: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x117D232: av_malloc (in ffmpeg_g)
==15798==    by 0x1163245: av_buffer_alloc (in ffmpeg_g)
==15798==    by 0x11632BD: av_buffer_allocz (in ffmpeg_g)
==15798==    by 0xFFCB88: ff_alloc_picture (in ffmpeg_g)
==15798==    by 0xA34257: ff_mpv_frame_start (in ffmpeg_g)
==15798==    by 0x9FC981: decode_chunks (in ffmpeg_g)
==15798==    by 0x9FD024: mpeg_decode_frame (in ffmpeg_g)
==15798==    by 0x8316BE: decode_receive_frame_internal (in ffmpeg_g)
==15798==    by 0x83226F: avcodec_send_packet (in ffmpeg_g)
==15798==    by 0x31B10B: decode_video (in ffmpeg_g)
==15798==    by 0x31D048: transcode (in ffmpeg_g)
==15798==    by 0x2EF743: main (in ffmpeg_g)
==15798== 
==15798== Invalid write of size 8
==15798==    at 0xD81A79: ??? (in ffmpeg_g)
==15798==  Address 0x6071bc48 is 8 bytes inside a block of size 24 free'd
==15798==    at 0x4C32D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x116332A: av_buffer_unref (in ffmpeg_g)
==15798==    by 0x116F5B5: av_frame_unref (in ffmpeg_g)
==15798==    by 0xFFC690: ff_mpeg_unref_picture (in ffmpeg_g)
==15798==    by 0xA340B5: ff_mpv_frame_start (in ffmpeg_g)
==15798==    by 0x9FC981: decode_chunks (in ffmpeg_g)
==15798==    by 0x9FD024: mpeg_decode_frame (in ffmpeg_g)
==15798==    by 0x8316BE: decode_receive_frame_internal (in ffmpeg_g)
==15798==    by 0x83226F: avcodec_send_packet (in ffmpeg_g)
==15798==    by 0x31B10B: decode_video (in ffmpeg_g)
==15798==    by 0x31D048: transcode (in ffmpeg_g)
==15798==    by 0x2EF743: main (in ffmpeg_g)
==15798==  Block was alloc'd at
==15798==    at 0x4C33E76: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x4C33F91: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x117D232: av_malloc (in ffmpeg_g)
==15798==    by 0x117D3E8: av_mallocz (in ffmpeg_g)
==15798==    by 0x11631C7: av_buffer_create (in ffmpeg_g)
==15798==    by 0x8338CC: ff_attach_decode_data (in ffmpeg_g)
==15798==    by 0x833AE4: ff_get_buffer (in ffmpeg_g)
==15798==    by 0xFFC832: ff_alloc_picture (in ffmpeg_g)
==15798==    by 0xA34257: ff_mpv_frame_start (in ffmpeg_g)
==15798==    by 0x9FC981: decode_chunks (in ffmpeg_g)
==15798==    by 0x9FD024: mpeg_decode_frame (in ffmpeg_g)
==15798==    by 0x8316BE: decode_receive_frame_internal (in ffmpeg_g)
==15798==    by 0x83226F: avcodec_send_packet (in ffmpeg_g)
==15798==    by 0x31B10B: decode_video (in ffmpeg_g)
==15798==    by 0x31D048: transcode (in ffmpeg_g)
==15798==    by 0x2EF743: main (in ffmpeg_g)
==15798== 
==15798== Invalid write of size 8
==15798==    at 0xD81A8C: ??? (in ffmpeg_g)
==15798==  Address 0x6071bf48 is 584 bytes inside a block of size 1,658 free'd
==15798==    at 0x4C32D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x116333E: av_buffer_unref (in ffmpeg_g)
==15798==    by 0x1163675: av_buffer_replace (in ffmpeg_g)
==15798==    by 0xFFCEA0: ff_update_picture_tables (in ffmpeg_g)
==15798==    by 0xFFD01A: ff_mpeg_ref_picture (in ffmpeg_g)
==15798==    by 0xA34384: ff_mpv_frame_start (in ffmpeg_g)
==15798==    by 0x9FC981: decode_chunks (in ffmpeg_g)
==15798==    by 0x9FD024: mpeg_decode_frame (in ffmpeg_g)
==15798==    by 0x8316BE: decode_receive_frame_internal (in ffmpeg_g)
==15798==    by 0x83226F: avcodec_send_packet (in ffmpeg_g)
==15798==    by 0x31B10B: decode_video (in ffmpeg_g)
==15798==    by 0x31D048: transcode (in ffmpeg_g)
==15798==    by 0x2EF743: main (in ffmpeg_g)
==15798==  Block was alloc'd at
==15798==    at 0x4C33E76: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x4C33F91: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x117D232: av_malloc (in ffmpeg_g)
==15798==    by 0x1163245: av_buffer_alloc (in ffmpeg_g)
==15798==    by 0x11632BD: av_buffer_allocz (in ffmpeg_g)
==15798==    by 0xFFCB88: ff_alloc_picture (in ffmpeg_g)
==15798==    by 0xA34257: ff_mpv_frame_start (in ffmpeg_g)
==15798==    by 0x9FC981: decode_chunks (in ffmpeg_g)
==15798==    by 0x9FD024: mpeg_decode_frame (in ffmpeg_g)
==15798==    by 0x8316BE: decode_receive_frame_internal (in ffmpeg_g)
==15798==    by 0x83226F: avcodec_send_packet (in ffmpeg_g)
==15798==    by 0x31B10B: decode_video (in ffmpeg_g)
==15798==    by 0x31D048: transcode (in ffmpeg_g)
==15798==    by 0x2EF743: main (in ffmpeg_g)
==15798== 
==15798== Invalid read of size 8
==15798==    at 0xD81A08: ??? (in ffmpeg_g)
==15798==  Address 0x606e4e90 is 1 bytes after a block of size 442,447 alloc'd
==15798==    at 0x4C33E76: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x4C33F91: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x117D232: av_malloc (in ffmpeg_g)
==15798==    by 0x1163245: av_buffer_alloc (in ffmpeg_g)
==15798==    by 0x11632BD: av_buffer_allocz (in ffmpeg_g)
==15798==    by 0x1163AA4: av_buffer_pool_get (in ffmpeg_g)
==15798==    by 0x8D80C4: avcodec_default_get_buffer2 (in ffmpeg_g)
==15798==    by 0x833ACA: ff_get_buffer (in ffmpeg_g)
==15798==    by 0xFFC832: ff_alloc_picture (in ffmpeg_g)
==15798==    by 0xA34257: ff_mpv_frame_start (in ffmpeg_g)
==15798==    by 0x9FC981: decode_chunks (in ffmpeg_g)
==15798==    by 0x9FD024: mpeg_decode_frame (in ffmpeg_g)
==15798==    by 0x8316BE: decode_receive_frame_internal (in ffmpeg_g)
==15798==    by 0x83226F: avcodec_send_packet (in ffmpeg_g)
==15798==    by 0x31B10B: decode_video (in ffmpeg_g)
==15798==    by 0x31D048: transcode (in ffmpeg_g)
==15798==    by 0x2EF743: main (in ffmpeg_g)
==15798== 
==15798== Invalid write of size 8
==15798==    at 0xD81A6B: ??? (in ffmpeg_g)
==15798==  Address 0x606e4e90 is 1 bytes after a block of size 442,447 alloc'd
==15798==    at 0x4C33E76: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x4C33F91: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x117D232: av_malloc (in ffmpeg_g)
==15798==    by 0x1163245: av_buffer_alloc (in ffmpeg_g)
==15798==    by 0x11632BD: av_buffer_allocz (in ffmpeg_g)
==15798==    by 0x1163AA4: av_buffer_pool_get (in ffmpeg_g)
==15798==    by 0x8D80C4: avcodec_default_get_buffer2 (in ffmpeg_g)
==15798==    by 0x833ACA: ff_get_buffer (in ffmpeg_g)
==15798==    by 0xFFC832: ff_alloc_picture (in ffmpeg_g)
==15798==    by 0xA34257: ff_mpv_frame_start (in ffmpeg_g)
==15798==    by 0x9FC981: decode_chunks (in ffmpeg_g)
==15798==    by 0x9FD024: mpeg_decode_frame (in ffmpeg_g)
==15798==    by 0x8316BE: decode_receive_frame_internal (in ffmpeg_g)
==15798==    by 0x83226F: avcodec_send_packet (in ffmpeg_g)
==15798==    by 0x31B10B: decode_video (in ffmpeg_g)
==15798==    by 0x31D048: transcode (in ffmpeg_g)
==15798==    by 0x2EF743: main (in ffmpeg_g)
==15798== 
==15798== Invalid write of size 8
==15798==    at 0xD81A74: ??? (in ffmpeg_g)
==15798==  Address 0x6071b688 is 110,664 bytes inside a block of size 110,671 alloc'd
==15798==    at 0x4C33E76: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x4C33F91: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x117D232: av_malloc (in ffmpeg_g)
==15798==    by 0x1163245: av_buffer_alloc (in ffmpeg_g)
==15798==    by 0x11632BD: av_buffer_allocz (in ffmpeg_g)
==15798==    by 0x1163AA4: av_buffer_pool_get (in ffmpeg_g)
==15798==    by 0x8D80C4: avcodec_default_get_buffer2 (in ffmpeg_g)
==15798==    by 0x833ACA: ff_get_buffer (in ffmpeg_g)
==15798==    by 0xFFC832: ff_alloc_picture (in ffmpeg_g)
==15798==    by 0xA34257: ff_mpv_frame_start (in ffmpeg_g)
==15798==    by 0x9FC981: decode_chunks (in ffmpeg_g)
==15798==    by 0x9FD024: mpeg_decode_frame (in ffmpeg_g)
==15798==    by 0x8316BE: decode_receive_frame_internal (in ffmpeg_g)
==15798==    by 0x83226F: avcodec_send_packet (in ffmpeg_g)
==15798==    by 0x31B10B: decode_video (in ffmpeg_g)
==15798==    by 0x31D048: transcode (in ffmpeg_g)
==15798==    by 0x2EF743: main (in ffmpeg_g)
==15798== 
==15798== Invalid read of size 8
==15798==    at 0xD81A1E: ??? (in ffmpeg_g)
==15798==  Address 0x6071b698 is 9 bytes after a block of size 110,671 alloc'd
==15798==    at 0x4C33E76: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x4C33F91: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x117D232: av_malloc (in ffmpeg_g)
==15798==    by 0x1163245: av_buffer_alloc (in ffmpeg_g)
==15798==    by 0x11632BD: av_buffer_allocz (in ffmpeg_g)
==15798==    by 0x1163AA4: av_buffer_pool_get (in ffmpeg_g)
==15798==    by 0x8D80C4: avcodec_default_get_buffer2 (in ffmpeg_g)
==15798==    by 0x833ACA: ff_get_buffer (in ffmpeg_g)
==15798==    by 0xFFC832: ff_alloc_picture (in ffmpeg_g)
==15798==    by 0xA34257: ff_mpv_frame_start (in ffmpeg_g)
==15798==    by 0x9FC981: decode_chunks (in ffmpeg_g)
==15798==    by 0x9FD024: mpeg_decode_frame (in ffmpeg_g)
==15798==    by 0x8316BE: decode_receive_frame_internal (in ffmpeg_g)
==15798==    by 0x83226F: avcodec_send_packet (in ffmpeg_g)
==15798==    by 0x31B10B: decode_video (in ffmpeg_g)
==15798==    by 0x31D048: transcode (in ffmpeg_g)
==15798==    by 0x2EF743: main (in ffmpeg_g)
==15798== 
==15798== Invalid read of size 8
==15798==    at 0xD81A24: ??? (in ffmpeg_g)
==15798==  Address 0x6071b998 is 0 bytes after a block of size 88 alloc'd
==15798==    at 0x4C33E76: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x4C33F91: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x117D232: av_malloc (in ffmpeg_g)
==15798==    by 0x117D3E8: av_mallocz (in ffmpeg_g)
==15798==    by 0x11639EB: av_buffer_pool_get (in ffmpeg_g)
==15798==    by 0x8D80C4: avcodec_default_get_buffer2 (in ffmpeg_g)
==15798==    by 0x833ACA: ff_get_buffer (in ffmpeg_g)
==15798==    by 0xFFC832: ff_alloc_picture (in ffmpeg_g)
==15798==    by 0xA34257: ff_mpv_frame_start (in ffmpeg_g)
==15798==    by 0x9FC981: decode_chunks (in ffmpeg_g)
==15798==    by 0x9FD024: mpeg_decode_frame (in ffmpeg_g)
==15798==    by 0x8316BE: decode_receive_frame_internal (in ffmpeg_g)
==15798==    by 0x83226F: avcodec_send_packet (in ffmpeg_g)
==15798==    by 0x31B10B: decode_video (in ffmpeg_g)
==15798==    by 0x31D048: transcode (in ffmpeg_g)
==15798==    by 0x2EF743: main (in ffmpeg_g)
==15798== 
==15798== Invalid write of size 8
==15798==    at 0xD81A87: ??? (in ffmpeg_g)
==15798==  Address 0x6071b998 is 0 bytes after a block of size 88 alloc'd
==15798==    at 0x4C33E76: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x4C33F91: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15798==    by 0x117D232: av_malloc (in ffmpeg_g)
==15798==    by 0x117D3E8: av_mallocz (in ffmpeg_g)
==15798==    by 0x11639EB: av_buffer_pool_get (in ffmpeg_g)
==15798==    by 0x8D80C4: avcodec_default_get_buffer2 (in ffmpeg_g)
==15798==    by 0x833ACA: ff_get_buffer (in ffmpeg_g)
==15798==    by 0xFFC832: ff_alloc_picture (in ffmpeg_g)
==15798==    by 0xA34257: ff_mpv_frame_start (in ffmpeg_g)
==15798==    by 0x9FC981: decode_chunks (in ffmpeg_g)
==15798==    by 0x9FD024: mpeg_decode_frame (in ffmpeg_g)
==15798==    by 0x8316BE: decode_receive_frame_internal (in ffmpeg_g)
==15798==    by 0x83226F: avcodec_send_packet (in ffmpeg_g)
==15798==    by 0x31B10B: decode_video (in ffmpeg_g)
==15798==    by 0x31D048: transcode (in ffmpeg_g)
==15798==    by 0x2EF743: main (in ffmpeg_g)




[...]
diff mbox series

Patch

diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index 2aa6f1d864..bd7050062c 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -805,8 +805,7 @@  void ff_er_frame_start(ERContext *s)
 static int er_supported(ERContext *s)
 {
     if(s->avctx->hwaccel && s->avctx->hwaccel->decode_slice           ||
-       !s->cur_pic.f                                                  ||
-       s->cur_pic.field_picture
+       !s->cur_pic.f
     )
         return 0;
     return 1;
@@ -908,6 +907,12 @@  void ff_er_frame_end(ERContext *s)
                           (s->avctx->skip_top + s->avctx->skip_bottom)) {
         return;
     }
+
+    if (!s->warned_fields && (s->cur_pic.field_picture || s->cur_pic.f->interlaced_frame)) {
+        av_log(s->avctx, AV_LOG_WARNING, "Error concealment is not fully implemented for field pictures.\n");
+        s->warned_fields = 1;
+    }
+
     linesize = s->cur_pic.f->linesize;
 
     if (   s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO
diff --git a/libavcodec/error_resilience.h b/libavcodec/error_resilience.h
index 47cc8a4fc6..55efacaccc 100644
--- a/libavcodec/error_resilience.h
+++ b/libavcodec/error_resilience.h
@@ -87,6 +87,7 @@  typedef struct ERContext {
                       int (*mv)[2][4][2],
                       int mb_x, int mb_y, int mb_intra, int mb_skipped);
     void *opaque;
+    int warned_fields;
 } ERContext;
 
 void ff_er_frame_start(ERContext *s);