[Ffmpeg-devel] avcodec_find_best_pix_fmt1 matching problem
Panagiotis Issaris
takis.issaris
Wed Feb 28 18:06:08 CET 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
Isn't there a problem on line 677 of this code?
It appears to me that PIX_FMT_NB is to large (being 37), to allow the
bitshifting to work flawlessly.
666 static int avcodec_find_best_pix_fmt1(int pix_fmt_mask,
667 int src_pix_fmt,
668 int has_alpha,
669 int loss_mask)
670 {
671 int dist, i, loss, min_dist, dst_pix_fmt;
672
673 /* find exact color match with smallest size */
674 dst_pix_fmt = -1;
675 min_dist = 0x7fffffff;
676 for(i = 0;i < PIX_FMT_NB; i++) {
677 if (pix_fmt_mask & (1 << i)) {
678 loss = avcodec_get_pix_fmt_loss(i, src_pix_fmt,
has_alpha) & loss_mask;
679 if (loss == 0) {
680 dist = avg_bits_per_pixel(i);
681 if (dist < min_dist) {
682 min_dist = dist;
683 dst_pix_fmt = i;
684 }
685 }
686 }
687 }
688 return dst_pix_fmt; 689 }
With friendly regards,
Takis
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF5baA9kOxLuzz4CkRAjEJAJsGGdQtF2gaDwY94xZT0QZjxOsRuACfZvN1
VUBrDQyqv+cJCVA8TKHep/w=
=nbim
-----END PGP SIGNATURE-----
More information about the ffmpeg-devel
mailing list