[FFmpeg-devel] [PATCH] Remove imgconvert.c:avg_bits_per_pixel()

Stefano Sabatini stefano.sabatini-lala
Mon Feb 1 00:36:16 CET 2010


On date Sunday 2010-01-31 17:05:23 +0100, Michael Niedermayer encoded:
> On Sun, Jan 31, 2010 at 04:55:22PM +0100, Stefano Sabatini wrote:
> > Hi, as in subject.
> > 
> > Follows the difference between the avg_bits_per_pixel() and
> > av_get_bits_per_pixel() (the second value comes from
> > av_get_bits_per_pixel(), which is also right).
> > 
> > bgr4_byte: 8 4
> > rgb4_byte: 8 4
> > yuva420p: 12 20
> > rgb555be: 16 15
> > rgb555le: 16 15
> > bgr555be: 16 15
> > bgr555le: 16 15
> > 
> > Regression test passed.
> 
> [...]
> > @@ -882,7 +834,7 @@
> >          if (pix_fmt_mask & (1ULL << i)) {
> >              loss = avcodec_get_pix_fmt_loss(i, src_pix_fmt, has_alpha) & loss_mask;
> >              if (loss == 0) {
> > -                dist = avg_bits_per_pixel(i);
> > +                dist = av_get_bits_per_pixel(&av_pix_fmt_descriptors[i]);
> >                  if (dist < min_dist) {
> >                      min_dist = dist;
> >                      dst_pix_fmt = i;
> 
> your change is incorrect, this function selects the pix format that is most
> compact within the losses the user accepts. (should probably let the user
> specify how many bits he is willing to loose as well)
> after yor change it favors formats that are worse but not more compact

I don't see how my change could have do that, I simply removed a wrong
implementation of a function for computing the average bits per pixel
with a correct one.

Then we may agree that the logic of the function may be improved...

Regards.
-- 
FFmpeg = Freak and Fanciful Murdering Pitiful Exuberant Gadget



More information about the ffmpeg-devel mailing list