~ubuntu-branches/ubuntu/utopic/libav/utopic-proposed

« back to all changes in this revision

Viewing changes to libavcodec/h264_ps.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler, Reinhard Tartler, Rico Tzschichholz
  • Date: 2014-08-30 11:02:45 UTC
  • mfrom: (1.3.47 sid)
  • Revision ID: package-import@ubuntu.com-20140830110245-io3dg7q85wfr7125
Tags: 6:11~beta1-2
[ Reinhard Tartler ]
* Make libavcodec-dev depend on libavresample-dev

[ Rico Tzschichholz ]
* Some fixes and leftovers from soname bumps

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 * @author Michael Niedermayer <michaelni@gmx.at>
26
26
 */
27
27
 
 
28
#include <inttypes.h>
 
29
 
28
30
#include "libavutil/imgutils.h"
29
31
#include "internal.h"
30
32
#include "avcodec.h"
186
188
        sps->time_scale        = get_bits_long(&h->gb, 32);
187
189
        if (!sps->num_units_in_tick || !sps->time_scale) {
188
190
            av_log(h->avctx, AV_LOG_ERROR,
189
 
                   "time_scale/num_units_in_tick invalid or unsupported (%d/%d)\n",
 
191
                   "time_scale/num_units_in_tick invalid or unsupported (%"PRIu32"/%"PRIu32")\n",
190
192
                   sps->time_scale, sps->num_units_in_tick);
191
193
            return AVERROR_INVALIDDATA;
192
194
        }
306
308
    constraint_set_flags |= get_bits1(&h->gb) << 1;   // constraint_set1_flag
307
309
    constraint_set_flags |= get_bits1(&h->gb) << 2;   // constraint_set2_flag
308
310
    constraint_set_flags |= get_bits1(&h->gb) << 3;   // constraint_set3_flag
309
 
    get_bits(&h->gb, 4); // reserved
 
311
    constraint_set_flags |= get_bits1(&h->gb) << 4;   // constraint_set4_flag
 
312
    constraint_set_flags |= get_bits1(&h->gb) << 5;   // constraint_set5_flag
 
313
    skip_bits(&h->gb, 2);                             // reserved_zero_2bits
310
314
    level_idc = get_bits(&h->gb, 8);
311
315
    sps_id    = get_ue_golomb_31(&h->gb);
312
316
 
328
332
    memset(sps->scaling_matrix8, 16, sizeof(sps->scaling_matrix8));
329
333
    sps->scaling_matrix_present = 0;
330
334
 
331
 
    if (sps->profile_idc == 100 || sps->profile_idc == 110 ||
332
 
        sps->profile_idc == 122 || sps->profile_idc == 244 ||
333
 
        sps->profile_idc ==  44 || sps->profile_idc ==  83 ||
334
 
        sps->profile_idc ==  86 || sps->profile_idc == 118 ||
335
 
        sps->profile_idc == 128 || sps->profile_idc == 144) {
 
335
    if (sps->profile_idc == 100 ||  // High profile
 
336
        sps->profile_idc == 110 ||  // High10 profile
 
337
        sps->profile_idc == 122 ||  // High422 profile
 
338
        sps->profile_idc == 244 ||  // High444 Predictive profile
 
339
        sps->profile_idc ==  44 ||  // Cavlc444 profile
 
340
        sps->profile_idc ==  83 ||  // Scalable Constrained High profile (SVC)
 
341
        sps->profile_idc ==  86 ||  // Scalable High Intra profile (SVC)
 
342
        sps->profile_idc == 118 ||  // Stereo High profile (MVC)
 
343
        sps->profile_idc == 128 ||  // Multiview High profile (MVC)
 
344
        sps->profile_idc == 138 ||  // Multiview Depth High profile (MVCD)
 
345
        sps->profile_idc == 144) {  // old High444 profile
336
346
        sps->chroma_format_idc = get_ue_golomb_31(&h->gb);
337
347
        if (sps->chroma_format_idc > 3) {
338
348
            avpriv_request_sample(h->avctx, "chroma_format_idc %u",
380
390
        if ((unsigned)sps->poc_cycle_length >=
381
391
            FF_ARRAY_ELEMS(sps->offset_for_ref_frame)) {
382
392
            av_log(h->avctx, AV_LOG_ERROR,
383
 
                   "poc_cycle_length overflow %u\n", sps->poc_cycle_length);
 
393
                   "poc_cycle_length overflow %d\n", sps->poc_cycle_length);
384
394
            goto fail;
385
395
        }
386
396
 
392
402
    }
393
403
 
394
404
    sps->ref_frame_count = get_ue_golomb_31(&h->gb);
395
 
    if (sps->ref_frame_count > MAX_PICTURE_COUNT - 2 ||
 
405
    if (sps->ref_frame_count > H264_MAX_PICTURE_COUNT - 2 ||
396
406
        sps->ref_frame_count >= 32U) {
397
407
        av_log(h->avctx, AV_LOG_ERROR,
398
408
               "too many reference frames %d\n", sps->ref_frame_count);
436
446
 
437
447
        if (h->avctx->flags2 & CODEC_FLAG2_IGNORE_CROP) {
438
448
            av_log(h->avctx, AV_LOG_DEBUG, "discarding sps cropping, original "
439
 
                                           "values are l:%u r:%u t:%u b:%u\n",
 
449
                                           "values are l:%d r:%d t:%d b:%d\n",
440
450
                   crop_left, crop_right, crop_top, crop_bottom);
441
451
 
442
452
            sps->crop_left   =
485
495
    if (h->avctx->debug & FF_DEBUG_PICT_INFO) {
486
496
        static const char csp[4][5] = { "Gray", "420", "422", "444" };
487
497
        av_log(h->avctx, AV_LOG_DEBUG,
488
 
               "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%d/%d/%d/%d %s %s %d/%d\n",
 
498
               "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%u/%u/%u/%u %s %s %"PRId32"/%"PRId32"\n",
489
499
               sps_id, sps->profile_idc, sps->level_idc,
490
500
               sps->poc_type,
491
501
               sps->ref_frame_count,
543
553
        return AVERROR(ENOMEM);
544
554
    pps->sps_id = get_ue_golomb_31(&h->gb);
545
555
    if ((unsigned)pps->sps_id >= MAX_SPS_COUNT ||
546
 
        h->sps_buffers[pps->sps_id] == NULL) {
 
556
        !h->sps_buffers[pps->sps_id]) {
547
557
        av_log(h->avctx, AV_LOG_ERROR, "sps_id %u out of range\n", pps->sps_id);
548
558
        goto fail;
549
559
    }
631
641
 
632
642
    if (h->avctx->debug & FF_DEBUG_PICT_INFO) {
633
643
        av_log(h->avctx, AV_LOG_DEBUG,
634
 
               "pps:%u sps:%u %s slice_groups:%d ref:%d/%d %s qp:%d/%d/%d/%d %s %s %s %s\n",
 
644
               "pps:%u sps:%u %s slice_groups:%d ref:%u/%u %s qp:%d/%d/%d/%d %s %s %s %s\n",
635
645
               pps_id, pps->sps_id,
636
646
               pps->cabac ? "CABAC" : "CAVLC",
637
647
               pps->slice_group_count,