Commit b18a9c29713abc3a1b081de3f320ab53a47120c6 introduced a regression that broke some baseline RGB jpegs. (See Trac issue #4045). This fixes that.
Unified · Split
| @@ -1698,6 +1698,9 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask, · 1697 unmodified lines | |||
| 1698 | s->h_scount[i] = s->h_count[index]; | 1698 | s->h_scount[i] = s->h_count[index]; |
| 1699 | s->v_scount[i] = s->v_count[index]; | 1699 | s->v_scount[i] = s->v_count[index]; |
| 1700 | 1700 | ||
| 1701 | if(nb_components == 3 && s->nb_components == 3 && s->avctx->pix_fmt == AV_PIX_FMT_GBRP) | ||
| 1702 | index = (index+2)%3; | ||
| 1703 | |||
| 1701 | s->comp_index[i] = index; | 1704 | s->comp_index[i] = index; |
| 1702 | 1705 | ||
| 1703 | s->dc_index[i] = get_bits(&s->gb, 4); | 1706 | s->dc_index[i] = get_bits(&s->gb, 4); |
| @@ -2721,7 +2724,7 @@ the_end: · 1017 unmodified lines | |||
| 2721 | } | 2724 | } |
| 2722 | } | 2725 | } |
| 2723 | 2726 | ||
| 2724 | if (s->avctx->pix_fmt == AV_PIX_FMT_GBRP) { | 2727 | if (s->avctx->pix_fmt == AV_PIX_FMT_GBRP && s->progressive) { |
| 2725 | av_assert0(s->nb_components == 3); | 2728 | av_assert0(s->nb_components == 3); |
| 2726 | FFSWAP(uint8_t *, frame->data[0], frame->data[2]); | 2729 | FFSWAP(uint8_t *, frame->data[0], frame->data[2]); |
| 2727 | FFSWAP(uint8_t *, frame->data[0], frame->data[1]); | 2730 | FFSWAP(uint8_t *, frame->data[0], frame->data[1]); |