H264 parameter structure Three: sequence parameter set layer (SPS) & image parameter set semantics _parameters

Source: Internet
Author: User
   1:  seq_parameter_set_rbsp () {  
   2:      //PROFILE_IDC  LEVEL_IDC  specified  
   3:      PROFILE_IDC   
   4:      //Constraint_set0_flag  
   5:      Constraint_set0_flag   
   6:      //Constraint_set1_flag  
   7:      Constraint_set1_flag    
   8:      //Constraint_set2_flag  
   9:     Constraint_set2_flag   
  Ten:      //Reserved_zero_5bits  
  One:      reserved_zero_5bits/* equal to 0 * *    
  LEVEL_IDC/      * Specify the level of use */
  SEQ_PARAMETER_SET_ID/    * Indicates the ID number of this sequence parameter set,  this ID number will be referenced by the picture parameter set, the value of this syntactic element should be in [0,31], and the encoding needs to produce a new sequence set, using the new ID , rather than changing the contents of the original parameter set.  
        //LOG2_MAX_FRAME_NUM_MINUS4  This syntactic element is mainly for the reading of another syntactic element frame_num  service, Frame_num  
  :      LOG2_MAX_FRAME_NUM_MINUS4   
        //Pic_order_cnt_type  indicates POC (picture order  count)  
  :      Pic_order_cnt_type         
  :      if (pic_order_cnt_type    =    0)   
           //LOG2_MAX_PIC_ORDER_CNT_LSB_MINUS4  indicates the variable  
  LOG2_MAX_PIC_ORDER_CNT_LSB_MINUS4:              
  :      Else if (pic_order_cnt_type    =    1) {    
  :          //Delta_pic_order_always_zero_flag  
  Do  not appear in the title, and their value defaults to 0;  This syntactic element equals 0 o'clock, and the above two syntactic elements will appear in the title.  
  Delta_pic_order_always_zero_flag:              
            //Offset_for_non_ref_pic   is used to compute the POC of a reference frame or field, the value of this syntactic element should be in [Pow ( -2,)  , pow (2,)  –1].  
  Num:         offset_for_non_ref_pic    
  A          //Offset_for_top_to_bottom_field  is used to compute the bottom field of a frame, the  value of this syntactic element should be in [Pow ( -2)  , pow (2)  –1].  
  :          Offset_for_top_to_bottom_field    
  :         //Num_ref_frames_in_pic_order_cnt_cycle  
  :          num_ref_frames_in_pic_order_cnt_cycle    
  :          //Offset_for_ref__frame[i]  
  For          (i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++)  
  :              offset_for_ref_frame[i]    
  :      }    
  Per:      //Num_ref_frames   
  Num_ref_frames:         
  Panax Notoginseng:     //Gaps_in_frame_num_value_allowed_flag  
  Gaps_in_frame_num_value_allowed_flag:        
        ///PIC_WIDTH_IN_MBS_MINUS1  This syntactic element plus 1 indicates the image width in macro block: Picwidthinmbs = pic_width_in_mbs_minus1 + 1 Through this syntactic element decoder you can calculate the image width in pixels of the luminance component: Picwidthinsamplesl = picwidthinmbs * 16  
  :      Pic_width_in_mbs_minus1    
  A:      //Pic_height_in_map_units_minus1   This syntactic element plus 1 indicates the image height: picheightinmapunits = Pic_height_in_map_units_minus1 + 1  
  :      Pic_height_in_map_units_minus1    
        //Frame_mbs_only_flag   This syntactic element equals 0, the encoding mode of all images in this sequence is frame, and no other encoding mode exists; this syntactic element equals 1 o'clock  
  Of:      Frame_mbs_only_flag    
        //Mb_adaptive_frame_field_flag   Indicates whether this sequence belongs to the Frame field adaptive mode. Mb_adaptive_frame_field_flag equals 1 o'clock indicates that the image in this sequence if not the field pattern is the Frame field adaptive mode, equal to 0 when the image in this sequence is not the field pattern is the frame mode. Table  
  :      if (!frame_mbs_only_flag)   
  All:          Mb_adaptive_frame_field_flag    
  By:      //Direct_8x8_inference_flag    
  :      Direct_8x8_inference_flag    
  M:      //Frame_cropping_flag   
  Wuyi:      Frame_cropping_flag   
  "      If" (Frame_cropping_flag) {   
  From:          Frame_crop_left_offset    
  Si:          frame_crop_right_offset   
  Frame_crop_top_offset:             
  A:         frame_crop_bottom_offset    
  :      }   
  :      //Vui_parameters_present_flag      
  Vui_parameters_present_flag:         
         if (vui_parameters_present_flag)   
  :          vui_parameters ()         
         rbsp_trailing_bits ()        
  In:  }  


   1:  pic_parameter_set_rbsp () {   
   2:      
   3:     pic_parameter_set_id   
   4:      //seq_parameter_set_id  
   5:      seq_parameter_set_id   
   6:     //Entropy_coding_mode_flag  indicates the choice of entropy encoding, this syntactic element is 0 o'clock, the entropy encoding uses CAVLC, the syntactic element is 1 when the entropy coding is used CABAC  
   7:      Entropy_coding_mode_flag   
   8:      //Pic_order_present_flag        
   9:      Pic_order_present_flag   
  Ten:      //Num_slice_groups_minus1  This syntactic element plus 1 indicates the number of slices in the image.  there is no specific syntactic element in the H.264 to indicate whether to use the slice pattern, when this syntactic element equals 0 (that is, only one slice group), which means that no slice pattern is used, and there is no subsequent syntax element for calculating the slice group mapping.  
  One:      num_slice_groups_minus1   
        if (Num_slice_groups_minus1 > 0) {    
  /          * Slice_group_map_type is  used to indicate the type of slice division.  
  14:             
  :            -  
  :            -  when Frame_mbs_only_flag equals 0 o'clock  
  :                -  
  :                -  
  In  frame mode, map_units refers to a combination of two contiguous macro blocks, similar to the macro block pair.      
  Slice_group_map_type:                  
  :          if (slice_group_map_type    = =    0)         
  : For              (igroup = 0; igroup <= num_slice_groups_minus1; igroup++)         
  :                  //Run_length_minus1[i]     
  :                  run_length_minus1[Igroup]    
            else if (slice_group_map_type    = =    2)         
  : For              (igroup = 0; igroup < Num_slice_groups_minus1; igroup++) {         
  Per:                  //Top_left[i],bottom_right[i]   
  :                  top_left[Igroup]   
  :                  bottom_right[Igroup]   
  :              }         
  "          Else If" (    slice_group_map_type    = =    3    | |     
                        slice_group_map_type    = =    4    | |     
                        Slice_group_map_type    = =    
                //Slice_group_change_direction_flag with the next syntactic element to specify the exact slice segmentation method.  
  Slice_group_change_direction_flag:                 
  Per:             //Slice_group_change_rate_minus1       
  Panax Notoginseng:              slice_group_change_rate_minus1    
            /Else if (slice_group_map_type    = =    6) {    
               ///PIC_SIZE_IN_MAP_UNITS_MINUS1   the group type equals 6 o'clock to indicate the size of the image in Map_units.      
  :              Pic_size_in_map_units_minus1    
  : For              (i = 0; I <= pic_size_in_map_units_minus1; i++)         
  :                  //Slice_group_id[i]           
  A:                  slice_group_id[i]    
  :          }         
  :      }         
       //Num_ref_idx_l0_active_minus1  plus 1 indicates the length of the current reference frame queue, that is, how many reference frames (both short and long). It is noteworthy that when the current decoding image is in the field mode, the reference frame queue length should be the syntactic element multiplied by 2, because the field pattern must be decomposed in the form of field pairs. The  value of this syntactic element is likely to be overloaded at the title of the field pattern, which includes the Image field and the Field-field adaptive macro-block pair.  
  The        syntactic element num_ref_frames in the sequence parameter set is also related to the reference frame queue, the difference being that num_ref_frames indicates the maximum value of the reference frame queue, and the decoder uses its value to allocate the memory space; num_ref_idx_l0_ ACTIVE_MINUS1 indicates the current actual number of reference frames in this queue, as can be seen from its name "active." Image, instead of directly transferring the image's number, it transmits the image's ordinal in the reference frame queue. This sequence number is not transmitted in the code stream, this syntactic element is one of the most important syntactic elements in the H.264, the encoder to inform the decoder of a motion vector which refers to the reference is the encoder and decoder synchronously, in the same way the reference image into the queue, so as to obtain an ordinal number. This queue is updated dynamically after each image is solved, even after each slice. Maintaining reference frame queues is an important work of codec, and this syntactic element is an important basis for maintaining reference frame queues. The complex maintenance mechanism of reference frame queues is a h.264 important and characteristic component.  
  NUM_REF_IDX_L0_ACTIVE_MINUS1:         
  :      Num_ref_idx_l1_active_minus1  
  M:      //Weighted_pred_flag  
  Wuyi:     Weighted_pred_flag    
        (a)//Weighted_bipred_flag   to indicate whether to allow weighted predictions of B-slices, this syntactic element equals 0 when the default weighted predictive mode is used, or 1 when the explicit weighted predictive mode is used, or 2 when the implicit weighted predictive mode is used.  
  From:      WEIGHTED_BIPRED_IDC    
  Si:      //Pic_init_qp_minus26  
  PIC_INIT_QP_MINUS26/    * Relative to 26 * *    
  PIC_INIT_QS_MINUS26/    * Relative to 26 * *   
  :      //Chroma_qp_index_offset   
  Chroma_qp_index_offset:          
  :     //Deblocking_filter_control_present_flag  
  Deblocking_filter_control_present_flag:         
  :      //Constrained_intra_pred_flag  
  Constrained_intra_pred_flag:         
  Per:      //Redundant_pic_cnt_present_flag Indicate whether REDUNDANT_PIC_CNT will appear  
  £      redundant_pic_cnt_present_flag   
  :      rbsp_trailing_bits ()        
  A:  }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.