diff options
author | Matthew Einhorn <moiein2000@gmail.com> | 2011-08-17 01:58:33 -0400 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-08-18 01:02:34 +0200 |
commit | 39f9601c10f51fea519f16bccb4509f8ed3c51a7 (patch) | |
tree | 04ea94c758f7e75073a1f0ac3c10498dcb5bba10 /libavcodec/imgconvert.c | |
parent | dc6c36ce46d4c4d7cb63503afc2ee44f00bf3725 (diff) | |
download | ffmpeg-39f9601c10f51fea519f16bccb4509f8ed3c51a7.tar.gz |
lavc: fix avcodec_find_best_pix_fmt() when there's more than 64 pixel formats
This fixed the problem where if there's more than 64 pixel formats
defined avcodec_find_best_pix_fmt() returns the wrong pixel format.
Signed-off-by: Matthew Einhorn <moiein2000@gmail.com>
Signed-off-by: Stefano Sabatini <stefano.sabatini-lala@poste.it>
Diffstat (limited to 'libavcodec/imgconvert.c')
-rw-r--r-- | libavcodec/imgconvert.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 9efed50955..071d3122c9 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) { |