tiffenc: Enable RGB48LE (16-bit) encoding support

This commit is contained in:
Jean First 2011-09-25 16:03:21 +02:00 committed by Michael Niedermayer
parent 72381b2b47
commit 1a0770f3f7
1 changed files with 10 additions and 2 deletions

View File

@ -247,6 +247,14 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
s->subsampling[1] = 1; s->subsampling[1] = 1;
switch (avctx->pix_fmt) { switch (avctx->pix_fmt) {
case PIX_FMT_RGB48LE:
s->bpp = 48;
s->photometric_interpretation = 2;
bpp_tab[0] = 16;
bpp_tab[1] = 16;
bpp_tab[2] = 16;
bpp_tab[3] = 16;
break;
case PIX_FMT_RGB24: case PIX_FMT_RGB24:
s->bpp = 24; s->bpp = 24;
s->photometric_interpretation = 2; s->photometric_interpretation = 2;
@ -285,7 +293,7 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
return -1; return -1;
} }
if (!is_yuv) if (!is_yuv)
s->bpp_tab_size = ((s->bpp + 7) >> 3); s->bpp_tab_size = (s->bpp >= 48) ? ((s->bpp + 7) >> 4):((s->bpp + 7) >> 3);
if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE || s->compr == TIFF_LZW) if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE || s->compr == TIFF_LZW)
//best choose for DEFLATE //best choose for DEFLATE
@ -462,7 +470,7 @@ AVCodec ff_tiff_encoder = {
PIX_FMT_MONOBLACK, PIX_FMT_MONOWHITE, PIX_FMT_MONOBLACK, PIX_FMT_MONOWHITE,
PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P,
PIX_FMT_YUV444P, PIX_FMT_YUV410P, PIX_FMT_YUV444P, PIX_FMT_YUV410P,
PIX_FMT_YUV411P, PIX_FMT_YUV411P, PIX_FMT_RGB48LE,
PIX_FMT_NONE}, PIX_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("TIFF image"), .long_name = NULL_IF_CONFIG_SMALL("TIFF image"),
.priv_class= &class, .priv_class= &class,