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

Michael Niedermayer michaelni
Sun Jan 31 17:05:23 CET 2010


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

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100131/0aadef8e/attachment.pgp>



More information about the ffmpeg-devel mailing list