aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-13 23:41:10 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-14 00:08:44 +0200
commit8cda27b7537d15ef159cff94f3fe3dd7ab1330d4 (patch)
tree63adf516732da69e188de6467fdbc6083801dd5c
parentb3eb4f54c0d091ed518b38a5b90183d0d55fa729 (diff)
downloadffmpeg-8cda27b7537d15ef159cff94f3fe3dd7ab1330d4.tar.gz
avcodec_find_best_pix_fmt_of_2: fix handling or PIX_FMT_NONE
Fixes CID733775 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/imgconvert.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index 4846172e36..202fbf522e 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -564,7 +564,7 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt
loss_order1 = loss1 & loss_mask_order[i];
loss_order2 = loss2 & loss_mask_order[i];
- if (loss_order1 == 0 && loss_order2 == 0){ /* use format with smallest depth */
+ if (loss_order1 == 0 && loss_order2 == 0 && dst_pix_fmt2 != AV_PIX_FMT_NONE && dst_pix_fmt1 != AV_PIX_FMT_NONE){ /* use format with smallest depth */
dst_pix_fmt = avg_bits_per_pixel(dst_pix_fmt2) < avg_bits_per_pixel(dst_pix_fmt1) ? dst_pix_fmt2 : dst_pix_fmt1;
} else if (loss_order1 == 0 || loss_order2 == 0) { /* use format with no loss */
dst_pix_fmt = loss_order2 ? dst_pix_fmt1 : dst_pix_fmt2;