diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-07-06 01:44:03 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2012-07-06 19:32:44 +0000 |
commit | e100a259be12c0e0fc46a7a9e1f939fe63a27ff4 (patch) | |
tree | 8d79a8e914818256464580c5a5a84ccee8396102 | |
parent | 5997285d3a20a4b14a3525220679637823a5ee45 (diff) | |
download | ffmpeg-e100a259be12c0e0fc46a7a9e1f939fe63a27ff4.tar.gz |
tiffenc: simplify calculation of bpp_tab_size
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r-- | libavcodec/tiffenc.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c index 7361614505..6334339c1b 100644 --- a/libavcodec/tiffenc.c +++ b/libavcodec/tiffenc.c @@ -25,6 +25,7 @@ * @author Bartlomiej Wolowiec */ +#include "libavutil/imgutils.h" #include "libavutil/log.h" #include "libavutil/opt.h" @@ -300,7 +301,6 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt, s->bpp = 8 + (16 >> (shift_h + shift_v)); s->subsampling[0] = 1 << shift_h; s->subsampling[1] = 1 << shift_v; - s->bpp_tab_size = 3; is_yuv = 1; break; default: @@ -308,9 +308,8 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt, "This colors format is not supported\n"); return -1; } - if (!is_yuv) - s->bpp_tab_size = (s->bpp >= 48) ? ((s->bpp + 7) >> 4):((s->bpp + 7) >> 3); + s->bpp_tab_size = av_pix_fmt_descriptors[avctx->pix_fmt].nb_components; if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE || s->compr == TIFF_LZW) //best choose for DEFLATE s->rps = s->height; |