Commit 250c537f authored by kostya's avatar kostya

JPEG-LS 16-bit gray support

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@6781 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent b038a486
This diff is collapsed.
...@@ -1125,10 +1125,6 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s) ...@@ -1125,10 +1125,6 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
av_log(s->avctx, AV_LOG_ERROR, "only 8 bits/component accepted\n"); av_log(s->avctx, AV_LOG_ERROR, "only 8 bits/component accepted\n");
return -1; 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); height = get_bits(&s->gb, 16);
width = get_bits(&s->gb, 16); width = get_bits(&s->gb, 16);
...@@ -1141,6 +1137,10 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s) ...@@ -1141,6 +1137,10 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
if (nb_components <= 0 || if (nb_components <= 0 ||
nb_components > MAX_COMPONENTS) nb_components > MAX_COMPONENTS)
return -1; 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->nb_components = nb_components;
s->h_max = 1; s->h_max = 1;
s->v_max = 1; s->v_max = 1;
...@@ -1223,8 +1223,10 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s) ...@@ -1223,8 +1223,10 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
if(s->ls){ if(s->ls){
if(s->nb_components > 1) if(s->nb_components > 1)
s->avctx->pix_fmt = PIX_FMT_RGB24; s->avctx->pix_fmt = PIX_FMT_RGB24;
else else if(s->bits <= 8)
s->avctx->pix_fmt = PIX_FMT_GRAY8; s->avctx->pix_fmt = PIX_FMT_GRAY8;
else
s->avctx->pix_fmt = PIX_FMT_GRAY16;
} }
if(s->picture.data[0]) if(s->picture.data[0])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment