~ubuntu-branches/ubuntu/trusty/gst-libav1.0/trusty-proposed

« back to all changes in this revision

Viewing changes to gst-libs/ext/libav/libavcodec/mjpegdec.c

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2013-07-13 11:39:37 UTC
  • mfrom: (1.1.14)
  • Revision ID: package-import@ubuntu.com-20130713113937-46ye1u0rcmfbxs7e
Tags: 1.0.8-1
New upstream bugfix release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
266
266
        s->quant_index[i] = get_bits(&s->gb, 8);
267
267
        if (s->quant_index[i] >= 4)
268
268
            return -1;
 
269
        if (!s->h_count[i] || !s->v_count[i]) {
 
270
            av_log(s->avctx, AV_LOG_ERROR,
 
271
                   "Invalid sampling factor in component %d %d:%d\n",
 
272
                   i, s->h_count[i], s->v_count[i]);
 
273
            return AVERROR_INVALIDDATA;
 
274
        }
 
275
 
269
276
        av_log(s->avctx, AV_LOG_DEBUG, "component %d %d:%d id: %d quant:%d\n",
270
277
               i, s->h_count[i], s->v_count[i],
271
278
               s->component_id[i], s->quant_index[i]);
711
718
}
712
719
 
713
720
static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
714
 
                                 int point_transform)
 
721
                                 int point_transform, int nb_components)
715
722
{
716
723
    int i, mb_x, mb_y;
717
 
    const int nb_components = 3;
718
724
 
719
725
    for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
720
726
        for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
957
963
    int16_t *quant_matrix = s->quant_matrixes[s->quant_index[c]];
958
964
    GetBitContext mb_bitmask_gb;
959
965
 
 
966
    if (ss < 0  || ss >= 64 ||
 
967
        se < ss || se >= 64 ||
 
968
        Ah < 0  || Al < 0)
 
969
        return AVERROR_INVALIDDATA;
 
970
 
960
971
    if (mb_bitmask)
961
972
        init_get_bits(&mb_bitmask_gb, mb_bitmask, s->mb_width * s->mb_height);
962
973
 
1108
1119
                if (ljpeg_decode_rgb_scan(s, predictor, point_transform) < 0)
1109
1120
                    return -1;
1110
1121
            } else {
1111
 
                if (ljpeg_decode_yuv_scan(s, predictor, point_transform) < 0)
 
1122
                if (ljpeg_decode_yuv_scan(s, predictor, point_transform,
 
1123
                                          nb_components))
1112
1124
                    return -1;
1113
1125
            }
1114
1126
        }
1489
1501
            else if (start_code == COM)
1490
1502
                mjpeg_decode_com(s);
1491
1503
 
 
1504
            if (!CONFIG_JPEGLS_DECODER &&
 
1505
                (start_code == SOF48 || start_code == LSE)) {
 
1506
                av_log(avctx, AV_LOG_ERROR, "JPEG-LS support not enabled.\n");
 
1507
                return AVERROR(ENOSYS);
 
1508
            }
 
1509
 
1492
1510
            switch (start_code) {
1493
1511
            case SOI:
1494
1512
                s->restart_interval = 0;