[FFmpeg-devel] [RFC] Error concealment for B-frames/fixing issue 824

Reimar Döffinger Reimar.Doeffinger
Thu Apr 9 22:41:39 CEST 2009


On Thu, Apr 09, 2009 at 10:11:04PM +0200, Michael Niedermayer wrote:
> On Thu, Apr 09, 2009 at 11:37:32AM +0200, Reimar D?ffinger wrote:
> > Hello,
> > please be kind, I do not know much about the code...
> > My idea was that we already have error concealment code and it could be
> > used instead of just dropping B-frame, which attached patch should do.
> > I do admit though that I am not sure about the full consequence of this
> > change, in particular if it might make error concealment worse in some
> > cases.
> 
> [...]
> > Index: libavcodec/mpeg12.c
> > ===================================================================
> > --- libavcodec/mpeg12.c	(revision 18382)
> > +++ libavcodec/mpeg12.c	(working copy)
> > @@ -2385,10 +2385,7 @@
> >                  start_code <= SLICE_MAX_START_CODE) {
> >                  int mb_y= start_code - SLICE_MIN_START_CODE;
> >  
> > -                if(s2->last_picture_ptr==NULL){
> > -                /* Skip B-frames if we do not have reference frames. */
> > -                    if(s2->pict_type==FF_B_TYPE) break;
> > -                }
> > +                /* B-frames with missing reference frames are handled by error concealment code. */
> >                  if(s2->next_picture_ptr==NULL){
> >                  /* Skip P-frames if we do not have a reference frame or we have an invalid header. */
> >                      if(s2->pict_type==FF_P_TYPE && (s2->first_field || s2->picture_structure==PICT_FRAME)) break;
> 
> does this also let B frames before I frames pass? its very unlikely
> that such frames are decodeable that is with neither reference frame

Yes it does. Can't B-frames contain intra coded blocks? If yes running
it through error concealment still seems to make most sense to me,
particularly since in the long term error concealment could of course
be extended to detect "beyond repair" frames and skip them independent
of this - it's just my feeling that this code never belonged here and
should have been handled in error_concealment.c all along...
Though skipping B-frames only when
!s2->last_picture_ptr && !s2->next_picture_ptr
would be an option, too, if you prefer.



More information about the ffmpeg-devel mailing list