Merge commit '3a149e23d37f06d49ab0bb013a3b9cb0224bba5c'
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 17 Dec 2013 18:04:32 +0000 (19:04 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 17 Dec 2013 18:04:32 +0000 (19:04 +0100)
* commit '3a149e23d37f06d49ab0bb013a3b9cb0224bba5c':
  hevc: Refactor decode_nal_sei_frame_packing_arrangement

Conflicts:
libavcodec/hevc_sei.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/hevc_sei.c

@@@ -51,18 -48,15 +51,15 @@@ static void decode_nal_sei_decoded_pict
  
  static void decode_nal_sei_frame_packing_arrangement(HEVCContext *s)
  {
 -    GetBitContext *gb = &s->HEVClc.gb;
 +    GetBitContext *gb = &s->HEVClc->gb;
-     int cancel;
-     int quincunx =  0;
-     int content  = -1;
-     int type     = -1;
  
      get_ue_golomb(gb);                  // frame_packing_arrangement_id
-     cancel = get_bits1(gb);             // frame_packing_cancel_flag
-     if (cancel == 0) {
-         type     = get_bits(gb, 7);     // frame_packing_arrangement_type
-         quincunx = get_bits1(gb);       // quincunx_sampling_flag
-         content  = get_bits(gb, 6);     // content_interpretation_type
+     s->sei_frame_packing_present = !get_bits1(gb);
+     if (s->sei_frame_packing_present) {
+         s->frame_packing_arrangement_type = get_bits(gb, 7);
+         s->quincunx_subsampling           = get_bits1(gb);
+         s->content_interpretation_type    = get_bits(gb, 6);
  
          // the following skips spatial_flipping_flag frame0_flipped_flag
          // field_views_flag current_frame_is_frame0_flag
          skip_bits1(gb);         // frame_packing_arrangement_persistance_flag
      }
      skip_bits1(gb);             // upsampled_aspect_ratio_flag
-     s->sei_frame_packing_present      = (cancel == 0);
-     s->frame_packing_arrangement_type = type;
-     s->content_interpretation_type    = content;
-     s->quincunx_subsampling           = quincunx;
  }
  
 +static int decode_pic_timing(HEVCContext *s)
 +{
 +    GetBitContext *gb = &s->HEVClc->gb;
 +    HEVCSPS *sps;
 +
 +    if (!s->sps_list[s->active_seq_parameter_set_id])
 +        return(AVERROR(ENOMEM));
 +    sps = (HEVCSPS*)s->sps_list[s->active_seq_parameter_set_id]->data;
 +
 +    if (sps->vui.frame_field_info_present_flag) {
 +        int pic_struct = get_bits(gb, 4);
 +        s->picture_struct = AV_PICTURE_STRUCTURE_UNKNOWN;
 +        if (pic_struct == 2) {
 +            av_log(s->avctx, AV_LOG_DEBUG, "BOTTOM Field\n");
 +            s->picture_struct = AV_PICTURE_STRUCTURE_BOTTOM_FIELD;
 +        } else if (pic_struct == 1) {
 +            av_log(s->avctx, AV_LOG_DEBUG, "TOP Field\n");
 +            s->picture_struct = AV_PICTURE_STRUCTURE_TOP_FIELD;
 +        }
 +        get_bits(gb, 2);                   // source_scan_type
 +        get_bits(gb, 1);                   // duplicate_flag
 +    }
 +    return 1;
 +}
 +
 +static int active_parameter_sets(HEVCContext *s)
 +{
 +    GetBitContext *gb = &s->HEVClc->gb;
 +    int num_sps_ids_minus1;
 +    int i;
 +    unsigned active_seq_parameter_set_id;
 +
 +    get_bits(gb, 4); // active_video_parameter_set_id
 +    get_bits(gb, 1); // self_contained_cvs_flag
 +    get_bits(gb, 1); // num_sps_ids_minus1
 +    num_sps_ids_minus1 = get_ue_golomb_long(gb); // num_sps_ids_minus1
 +
 +    active_seq_parameter_set_id = get_ue_golomb_long(gb);
 +    if (active_seq_parameter_set_id >= MAX_SPS_COUNT) {
 +        av_log(s->avctx, AV_LOG_ERROR, "active_parameter_set_id %d invalid\n", active_seq_parameter_set_id);
 +        return AVERROR_INVALIDDATA;
 +    }
 +    s->active_seq_parameter_set_id = active_seq_parameter_set_id;
 +
 +    for (i = 1; i <= num_sps_ids_minus1; i++)
 +        get_ue_golomb_long(gb); // active_seq_parameter_set_id[i]
 +
 +    return 0;
 +}
 +
  static int decode_nal_sei_message(HEVCContext *s)
  {
 -    GetBitContext *gb = &s->HEVClc.gb;
 +    GetBitContext *gb = &s->HEVClc->gb;
  
      int payload_type = 0;
      int payload_size = 0;