[FFmpeg-devel] [PATCH] Fixes avcodec_find_best_pix_fmt() with more than 64 pix fmts defined

Stefano Sabatini stefano.sabatini-lala at poste.it
Thu Aug 18 01:08:01 CEST 2011


On date Wednesday 2011-08-17 15:32:23 +0200, Michael Niedermayer encoded:
> On Wed, Aug 17, 2011 at 10:43:34AM +0200, Stefano Sabatini wrote:
[...]
> > > diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
> > > index 9efed50..a4197cb 100644
> > > --- a/libavcodec/imgconvert.c
> > > +++ b/libavcodec/imgconvert.c
> > > @@ -439,7 +439,7 @@ static enum PixelFormat avcodec_find_best_pix_fmt1(int64_t pix_fmt_mask,
> > >      /* find exact color match with smallest size */
> > >      dst_pix_fmt = PIX_FMT_NONE;
> > >      min_dist = 0x7fffffff;
> > > -    for(i = 0;i < PIX_FMT_NB; i++) {
> > > +    for(i = 0;i < FFMIN(PIX_FMT_NB, 64); i++) {
> > >          if (pix_fmt_mask & (1ULL << i)) {
> > >              loss = avcodec_get_pix_fmt_loss(i, src_pix_fmt, has_alpha) & loss_mask;
> > >              if (loss == 0) {
> > 
> > Looks fine to me, I'm going to apply soon if I read no comments (maybe
> > Michael?).
> 
> LGTM

Applied as two separate patches.
-- 
FFmpeg = Funny and Faithful MultiPurpose EntanGlement


More information about the ffmpeg-devel mailing list