summaryrefslogtreecommitdiffstats
path: root/libavcodec/imgconvert.c
diff options
context:
space:
mode:
authorMatthew Einhorn <moiein2000@gmail.com>2011-08-17 01:58:33 -0400
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2011-08-18 01:02:34 +0200
commit39f9601c10f51fea519f16bccb4509f8ed3c51a7 (patch)
tree04ea94c758f7e75073a1f0ac3c10498dcb5bba10 /libavcodec/imgconvert.c
parentdc6c36ce46d4c4d7cb63503afc2ee44f00bf3725 (diff)
downloadffmpeg-streaming-39f9601c10f51fea519f16bccb4509f8ed3c51a7.zip
ffmpeg-streaming-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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index 9efed50..071d312 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) {
OpenPOWER on IntegriCloud