~ubuntu-branches/debian/sid/ffmpeg/sid

« back to all changes in this revision

Viewing changes to libavcodec/dvdec.c

  • Committer: Package Import Robot
  • Author(s): Andreas Cadhalpun, Fabian Greffrath, Andreas Cadhalpun
  • Date: 2015-09-22 15:15:20 UTC
  • mfrom: (0.1.29)
  • Revision ID: package-import@ubuntu.com-20150922151520-hhmd3in9ykigjvs9
Tags: 7:2.8-1
[ Fabian Greffrath ]
* Pass the --dbg-package=ffmpeg-dbg parameter only to dh_strip.
* Add alternative Depends: libavcodec-ffmpeg-extra56 to libavcodec-dev and
  ffmpeg-dbg to allow for building and debugging with this library installed.

[ Andreas Cadhalpun ]
* Import new major upstream release 2.8.
* Remove the transitional lib*-ffmpeg-dev packages.
* Drop old Breaks on kodi-bin.
* Drop workaround for sparc, which is no Debian architecture anymore.
* Re-enable x265 on alpha, as it's available again.
* Disable unavailable frei0r, opencv and x264 on mips64el.
* Disable libopenjpeg (#787275) and libschroedinger (#787957) decoders.
  (Closes: #786670)
* Disable libdc1394 on sparc64, because it links against the broken due to
  #790560 libudev1.
* Enable libsnappy support.
* Add new symbols.
* Update debian/copyright.
* Update debian/tests/encdec_list.txt.
* Add hls-only-seek-if-there-is-an-offset.patch. (Closes: #798189)
* Add 'Breaks: libavutil-ffmpeg54 (>= 8:0)' to the libraries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
287
287
    GetBitContext gb;
288
288
    BlockInfo mb_data[5 * DV_MAX_BPM], *mb, *mb1;
289
289
    LOCAL_ALIGNED_16(int16_t, sblock, [5 * DV_MAX_BPM], [64]);
290
 
    LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [80     + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
291
 
    LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [80 * 5 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
 
290
    LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [80     + AV_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
 
291
    LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [80 * 5 + AV_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
292
292
    const int log2_blocksize = 3-s->avctx->lowres;
293
293
    int is_field_mode[5];
 
294
    int vs_bit_buffer_damaged = 0;
 
295
    int mb_bit_buffer_damaged[5] = {0};
 
296
    int retried = 0;
 
297
    int sta;
294
298
 
295
299
    av_assert1((((int) mb_bit_buffer) & 7) == 0);
296
300
    av_assert1((((int) vs_bit_buffer) & 7) == 0);
297
301
 
 
302
retry:
 
303
 
298
304
    memset(sblock, 0, 5 * DV_MAX_BPM * sizeof(*sblock));
299
305
 
300
306
    /* pass 1: read DC and AC coefficients in blocks */
305
311
    for (mb_index = 0; mb_index < 5; mb_index++, mb1 += s->sys->bpm, block1 += s->sys->bpm * 64) {
306
312
        /* skip header */
307
313
        quant    = buf_ptr[3] & 0x0f;
 
314
        if (avctx->error_concealment) {
 
315
            if ((buf_ptr[3] >> 4) == 0x0E)
 
316
                vs_bit_buffer_damaged = 1;
 
317
            if (!mb_index) {
 
318
                sta = buf_ptr[3] >> 4;
 
319
            } else if (sta != (buf_ptr[3] >> 4))
 
320
                vs_bit_buffer_damaged = 1;
 
321
        }
308
322
        buf_ptr += 4;
309
323
        init_put_bits(&pb, mb_bit_buffer, 80);
310
324
        mb    = mb1;
349
363
             * block is finished */
350
364
            if (mb->pos >= 64)
351
365
                bit_copy(&pb, &gb);
 
366
            if (mb->pos >= 64 && mb->pos < 127)
 
367
                vs_bit_buffer_damaged = mb_bit_buffer_damaged[mb_index] = 1;
352
368
 
353
369
            block += 64;
354
370
            mb++;
355
371
        }
356
372
 
 
373
        if (mb_bit_buffer_damaged[mb_index] > 0)
 
374
            continue;
 
375
 
357
376
        /* pass 2: we can do it just after */
358
377
        ff_dlog(avctx, "***pass 2 size=%d MB#=%d\n", put_bits_count(&pb), mb_index);
359
378
        block = block1;
367
386
                /* if still not finished, no need to parse other blocks */
368
387
                if (mb->pos < 64)
369
388
                    break;
 
389
                if (mb->pos < 127)
 
390
                    vs_bit_buffer_damaged = mb_bit_buffer_damaged[mb_index] = 1;
370
391
            }
371
392
        }
372
393
        /* all blocks are finished, so the extra bytes can be used at
384
405
    flush_put_bits(&vs_pb);
385
406
    for (mb_index = 0; mb_index < 5; mb_index++) {
386
407
        for (j = 0; j < s->sys->bpm; j++) {
387
 
            if (mb->pos < 64 && get_bits_left(&gb) > 0) {
 
408
            if (mb->pos < 64 && get_bits_left(&gb) > 0 && !vs_bit_buffer_damaged) {
388
409
                ff_dlog(avctx, "start %d:%d\n", mb_index, j);
389
410
                dv_decode_ac(&gb, mb, block);
390
411
            }
391
 
            if (mb->pos >= 64 && mb->pos < 127)
 
412
 
 
413
            if (mb->pos >= 64 && mb->pos < 127) {
392
414
                av_log(avctx, AV_LOG_ERROR,
393
415
                       "AC EOB marker is absent pos=%d\n", mb->pos);
 
416
                vs_bit_buffer_damaged = 1;
 
417
            }
394
418
            block += 64;
395
419
            mb++;
396
420
        }
397
421
    }
 
422
    if (vs_bit_buffer_damaged && !retried) {
 
423
        av_log(avctx, AV_LOG_ERROR, "Concealing bitstream errors\n");
 
424
        retried = 1;
 
425
        goto retry;
 
426
    }
398
427
 
399
428
    /* compute idct and place blocks */
400
429
    block = &sblock[0][0];
539
568
    .priv_data_size = sizeof(DVVideoContext),
540
569
    .init           = dvvideo_decode_init,
541
570
    .decode         = dvvideo_decode_frame,
542
 
    .capabilities   = CODEC_CAP_DR1 | CODEC_CAP_SLICE_THREADS,
 
571
    .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SLICE_THREADS,
543
572
    .max_lowres     = 3,
544
573
};