Mercurial > libavcodec.hg
diff mjpeg.c @ 4069:0df780a93aa8 libavcodec
JPEG-LS 16-bit gray support
author | kostya |
---|---|
date | Tue, 24 Oct 2006 05:01:04 +0000 |
parents | c8c591fe26f8 |
children | 49c08d9b9646 |
line wrap: on
line diff
--- a/mjpeg.c Tue Oct 24 05:00:14 2006 +0000 +++ b/mjpeg.c Tue Oct 24 05:01:04 2006 +0000 @@ -1125,10 +1125,6 @@ av_log(s->avctx, AV_LOG_ERROR, "only 8 bits/component accepted\n"); return -1; } - if (s->bits > 8 && s->ls){ - av_log(s->avctx, AV_LOG_ERROR, "only <= 8 bits/component accepted for JPEG-LS\n"); - return -1; - } height = get_bits(&s->gb, 16); width = get_bits(&s->gb, 16); @@ -1141,6 +1137,10 @@ if (nb_components <= 0 || nb_components > MAX_COMPONENTS) return -1; + if (s->ls && !(s->bits <= 8 || nb_components == 1)){ + av_log(s->avctx, AV_LOG_ERROR, "only <= 8 bits/component or 16-bit gray accepted for JPEG-LS\n"); + return -1; + } s->nb_components = nb_components; s->h_max = 1; s->v_max = 1; @@ -1223,8 +1223,10 @@ if(s->ls){ if(s->nb_components > 1) s->avctx->pix_fmt = PIX_FMT_RGB24; + else if(s->bits <= 8) + s->avctx->pix_fmt = PIX_FMT_GRAY8; else - s->avctx->pix_fmt = PIX_FMT_GRAY8; + s->avctx->pix_fmt = PIX_FMT_GRAY16; } if(s->picture.data[0])