~ubuntu-branches/ubuntu/raring/gst-libav1.0/raring

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2013-03-22 18:30:16 UTC
  • mfrom: (13.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130322183016-j9g41he8zscizfsj
Tags: 1.0.6-1
New upstream bugfix release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
//#undef NDEBUG
38
38
#include <assert.h>
39
39
 
 
40
#define MAX_LOG2_MAX_FRAME_NUM    (12 + 4)
 
41
#define MIN_LOG2_MAX_FRAME_NUM    4
 
42
 
40
43
static const AVRational pixel_aspect[17]={
41
44
 {0, 1},
42
45
 {1, 1},
301
304
    MpegEncContext * const s = &h->s;
302
305
    int profile_idc, level_idc, constraint_set_flags = 0;
303
306
    unsigned int sps_id;
304
 
    int i;
 
307
    int i, log2_max_frame_num_minus4;
305
308
    SPS *sps;
306
309
 
307
310
    profile_idc= get_bits(&s->gb, 8);
330
333
    memset(sps->scaling_matrix8, 16, sizeof(sps->scaling_matrix8));
331
334
    sps->scaling_matrix_present = 0;
332
335
 
333
 
    if(sps->profile_idc >= 100){ //high profile
 
336
    if (sps->profile_idc == 100 || sps->profile_idc == 110 ||
 
337
        sps->profile_idc == 122 || sps->profile_idc == 244 ||
 
338
        sps->profile_idc ==  44 || sps->profile_idc ==  83 ||
 
339
        sps->profile_idc ==  86 || sps->profile_idc == 118 ||
 
340
        sps->profile_idc == 128 || sps->profile_idc == 144) {
334
341
        sps->chroma_format_idc= get_ue_golomb_31(&s->gb);
335
342
        if(sps->chroma_format_idc > 3) {
336
343
            av_log(h->s.avctx, AV_LOG_ERROR, "chroma_format_idc (%u) out of range\n", sps->chroma_format_idc);
348
355
        sps->bit_depth_chroma = 8;
349
356
    }
350
357
 
351
 
    sps->log2_max_frame_num= get_ue_golomb(&s->gb) + 4;
 
358
    log2_max_frame_num_minus4 = get_ue_golomb(&s->gb);
 
359
    if (log2_max_frame_num_minus4 < MIN_LOG2_MAX_FRAME_NUM - 4 ||
 
360
        log2_max_frame_num_minus4 > MAX_LOG2_MAX_FRAME_NUM - 4) {
 
361
        av_log(h->s.avctx, AV_LOG_ERROR,
 
362
               "log2_max_frame_num_minus4 out of range (0-12): %d\n",
 
363
               log2_max_frame_num_minus4);
 
364
        return AVERROR_INVALIDDATA;
 
365
    }
 
366
    sps->log2_max_frame_num = log2_max_frame_num_minus4 + 4;
 
367
 
352
368
    sps->poc_type= get_ue_golomb_31(&s->gb);
353
369
 
354
370
    if(sps->poc_type == 0){ //FIXME #define