[FFmpeg-devel] [PATCH 2/2] lavi/pixdesc: simplify depth computatoin in get_pix_fmt_score().
Nicolas George
george at nsup.org
Sun Aug 22 17:54:09 EEST 2021
Signed-off-by: Nicolas George <george at nsup.org>
---
libavutil/pixdesc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index f1898a6a13..967de7dcde 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2721,10 +2721,10 @@ static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components);
for (i = 0; i < nb_components; i++) {
- int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1);
- if (src_desc->comp[i].depth - 1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) {
+ int depth = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components + 1 : dst_desc->comp[i].depth;
+ if (src_desc->comp[i].depth > depth && (consider & FF_LOSS_DEPTH)) {
loss |= FF_LOSS_DEPTH;
- score -= 65536 >> depth_minus1;
+ score -= 131072 >> depth;
}
}
--
2.32.0
More information about the ffmpeg-devel
mailing list