Quoting Janne Grunau (2016-05-29 11:13:34)
> On 2016-05-16 10:25:54 +0200, Anton Khirnov wrote:
> > Currently it's done in the code that initialises the ref list for
> > MBAFF, which is not a logical place for it. Move it to the function that
> > parses the pred table from the bitstream, which is analogous to what is
> > done for the implicit weight table as well.
> > ---
> >  libavcodec/h264_parse.c | 10 +++++++++-
> >  libavcodec/h264_refs.c  |  7 -------
> >  2 files changed, 9 insertions(+), 8 deletions(-)
> > 
> > diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c
> > index 7211c9d..052e8e4 100644
> > --- a/libavcodec/h264_parse.c
> > +++ b/libavcodec/h264_parse.c
> > @@ -26,7 +26,7 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const 
> > SPS *sps,
> >                                const int *ref_count, int slice_type_nos,
> >                                H264PredWeightTable *pwt)
> >  {
> > -    int list, i;
> > +    int list, i, j;
> >      int luma_def, chroma_def;
> >  
> >      pwt->use_weight             = 0;
> > @@ -78,6 +78,14 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const 
> > SPS *sps,
> >                      }
> >                  }
> >              }
> > +
> > +            // for MBAFF
> > +            pwt->luma_weight[16 + 2 * i][list][0] = pwt->luma_weight[16 + 
> > 2 * i + 1][list][0] = pwt->luma_weight[i][list][0];
> > +            pwt->luma_weight[16 + 2 * i][list][1] = pwt->luma_weight[16 + 
> > 2 * i + 1][list][1] = pwt->luma_weight[i][list][1];
> > +            for (j = 0; j < 2; j++) {
> > +                pwt->chroma_weight[16 + 2 * i][list][j][0] = 
> > pwt->chroma_weight[16 + 2 * i + 1][list][j][0] = 
> > pwt->chroma_weight[i][list][j][0];
> > +                pwt->chroma_weight[16 + 2 * i][list][j][1] = 
> > pwt->chroma_weight[16 + 2 * i + 1][list][j][1] = 
> > pwt->chroma_weight[i][list][j][1];
> > +            }
> 
> maybe pass "FRAME_MBAFF(h)" as flag to ff_h264_pred_weight_table() and 
> make this block conditional. Probably won't be noticeable though 

The context-global variables might not always be set at this point, so
I'd prefer not to depend on them. Especially since, as you say, it's not
likely to be noticeable.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to