1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/mjpegdec: Fix rgb48 ljpeg

Fixes Ticket894

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-09-15 23:13:52 +02:00
parent 069010ffae
commit b4a5fcb998

View File

@ -357,7 +357,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
switch (pix_fmt_id) { switch (pix_fmt_id) {
case 0x11111100: case 0x11111100:
if (s->rgb) if (s->rgb)
s->avctx->pix_fmt = AV_PIX_FMT_BGR24; s->avctx->pix_fmt = s->bits <= 8 ? AV_PIX_FMT_BGR24 : AV_PIX_FMT_BGR48;
else { else {
if (s->component_id[0] == 'Q' && s->component_id[1] == 'F' && s->component_id[2] == 'A') { if (s->component_id[0] == 'Q' && s->component_id[1] == 'F' && s->component_id[2] == 'A') {
s->avctx->pix_fmt = s->bits <= 8 ? AV_PIX_FMT_GBRP : AV_PIX_FMT_GBRP16; s->avctx->pix_fmt = s->bits <= 8 ? AV_PIX_FMT_GBRP : AV_PIX_FMT_GBRP16;
@ -887,8 +887,14 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
} else { } else {
for(i=0; i<nb_components; i++) { for(i=0; i<nb_components; i++) {
int c= s->comp_index[i]; int c= s->comp_index[i];
for(mb_x = 0; mb_x < s->mb_width; mb_x++) { if (s->bits <= 8) {
ptr[3*mb_x+2-c] = buffer[mb_x][i]; for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
ptr[3*mb_x+2-c] = buffer[mb_x][i];
}
} else {
for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
((uint16_t*)ptr)[3*mb_x+2-c] = buffer[mb_x][i];
}
} }
} }
} }