Revision fe9a3fbe

View differences:

libavcodec/avcodec.h
2260 2260
#define FF_PROFILE_DTS_HD_HRA  50
2261 2261
#define FF_PROFILE_DTS_HD_MA   60
2262 2262

  
2263
#define FF_PROFILE_H264_BASELINE    66
2264
#define FF_PROFILE_H264_MAIN        77
2265
#define FF_PROFILE_H264_EXTENDED    88
2266
#define FF_PROFILE_H264_HIGH        100
2267
#define FF_PROFILE_H264_HIGH_10     110
2268
#define FF_PROFILE_H264_HIGH_422    122
2269
#define FF_PROFILE_H264_HIGH_444    244
2270
#define FF_PROFILE_H264_CAVLC_444   44
2263
#define FF_PROFILE_H264_CONSTRAINED  (1<<9)  // 8+1; constraint_set1_flag
2264
#define FF_PROFILE_H264_INTRA        (1<<11) // 8+3; constraint_set3_flag
2265

  
2266
#define FF_PROFILE_H264_BASELINE             66
2267
#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
2268
#define FF_PROFILE_H264_MAIN                 77
2269
#define FF_PROFILE_H264_EXTENDED             88
2270
#define FF_PROFILE_H264_HIGH                 100
2271
#define FF_PROFILE_H264_HIGH_10              110
2272
#define FF_PROFILE_H264_HIGH_10_INTRA        (110|FF_PROFILE_H264_INTRA)
2273
#define FF_PROFILE_H264_HIGH_422             122
2274
#define FF_PROFILE_H264_HIGH_422_INTRA       (122|FF_PROFILE_H264_INTRA)
2275
#define FF_PROFILE_H264_HIGH_444_PREDICTIVE  244
2276
#define FF_PROFILE_H264_HIGH_444_INTRA       (244|FF_PROFILE_H264_INTRA)
2277
#define FF_PROFILE_H264_CAVLC_444            44
2271 2278

  
2272 2279
    /**
2273 2280
     * level
libavcodec/h264.c
1678 1678
}
1679 1679

  
1680 1680
/**
1681
 * computes profile from profile_idc and constraint_set?_flags
1682
 *
1683
 * @param sps SPS
1684
 *
1685
 * @return profile as defined by FF_PROFILE_H264_*
1686
 */
1687
int ff_h264_get_profile(SPS *sps)
1688
{
1689
    int profile = sps->profile_idc;
1690

  
1691
    switch(sps->profile_idc) {
1692
    case FF_PROFILE_H264_BASELINE:
1693
        // constraint_set1_flag set to 1
1694
        profile |= (sps->constraint_set_flags & 1<<1) ? FF_PROFILE_H264_CONSTRAINED : 0;
1695
        break;
1696
    case FF_PROFILE_H264_HIGH_10:
1697
    case FF_PROFILE_H264_HIGH_422:
1698
    case FF_PROFILE_H264_HIGH_444_PREDICTIVE:
1699
        // constraint_set3_flag set to 1
1700
        profile |= (sps->constraint_set_flags & 1<<3) ? FF_PROFILE_H264_INTRA : 0;
1701
        break;
1702
    }
1703

  
1704
    return profile;
1705
}
1706

  
1707
/**
1681 1708
 * decodes a slice header.
1682 1709
 * This will also call MPV_common_init() and frame_start() as needed.
1683 1710
 *
......
1756 1783
    }
1757 1784
    h->sps = *h0->sps_buffers[h->pps.sps_id];
1758 1785

  
1759
    s->avctx->profile = h->sps.profile_idc;
1786
    s->avctx->profile = ff_h264_get_profile(&h->sps);
1760 1787
    s->avctx->level   = h->sps.level_idc;
1761 1788
    s->avctx->refs    = h->sps.ref_frame_count;
1762 1789

  
libavcodec/h264.h
209 209
    int bit_depth_luma;                ///< bit_depth_luma_minus8 + 8
210 210
    int bit_depth_chroma;              ///< bit_depth_chroma_minus8 + 8
211 211
    int residual_color_transform_flag; ///< residual_colour_transform_flag
212
    int constraint_set_flags;          ///< constraint_set[0-3]_flag
212 213
}SPS;
213 214

  
214 215
/**
......
612 613
int ff_h264_decode_seq_parameter_set(H264Context *h);
613 614

  
614 615
/**
616
 * compute profile from sps
617
 */
618
int ff_h264_get_profile(SPS *sps);
619

  
620
/**
615 621
 * Decode PPS
616 622
 */
617 623
int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length);
libavcodec/h264_parser.c
187 187
            h->sps = *h->sps_buffers[h->pps.sps_id];
188 188
            h->frame_num = get_bits(&h->s.gb, h->sps.log2_max_frame_num);
189 189

  
190
            avctx->profile = h->sps.profile_idc;
190
            avctx->profile = ff_h264_get_profile(&h->sps);
191 191
            avctx->level   = h->sps.level_idc;
192 192

  
193 193
            if(h->sps.frame_mbs_only_flag){
libavcodec/h264_ps.c
267 267

  
268 268
int ff_h264_decode_seq_parameter_set(H264Context *h){
269 269
    MpegEncContext * const s = &h->s;
270
    int profile_idc, level_idc;
270
    int profile_idc, level_idc, constraint_set_flags = 0;
271 271
    unsigned int sps_id;
272 272
    int i;
273 273
    SPS *sps;
274 274

  
275 275
    profile_idc= get_bits(&s->gb, 8);
276
    get_bits1(&s->gb);   //constraint_set0_flag
277
    get_bits1(&s->gb);   //constraint_set1_flag
278
    get_bits1(&s->gb);   //constraint_set2_flag
279
    get_bits1(&s->gb);   //constraint_set3_flag
276
    constraint_set_flags |= get_bits1(&s->gb) << 0;   //constraint_set0_flag
277
    constraint_set_flags |= get_bits1(&s->gb) << 1;   //constraint_set1_flag
278
    constraint_set_flags |= get_bits1(&s->gb) << 2;   //constraint_set2_flag
279
    constraint_set_flags |= get_bits1(&s->gb) << 3;   //constraint_set3_flag
280 280
    get_bits(&s->gb, 4); // reserved
281 281
    level_idc= get_bits(&s->gb, 8);
282 282
    sps_id= get_ue_golomb_31(&s->gb);
......
291 291

  
292 292
    sps->time_offset_length = 24;
293 293
    sps->profile_idc= profile_idc;
294
    sps->constraint_set_flags = constraint_set_flags;
294 295
    sps->level_idc= level_idc;
295 296

  
296 297
    memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4));

Also available in: Unified diff