From: http://blog.csdn.net/heanyu/article/details/6205390

H.264码流第一个 NALU 是 SPS(序列参数集Sequence Parameter Set)
对应H264标准文档 7.3.2.1 序列参数集的语法进行解析

SPS参数解析// fill sps with content of p
[cpp] view plaincopy
  1. int InterpretSPS (VideoParameters *p_Vid, DataPartition *p, seq_parameter_set_rbsp_t *sps)
  2. {
  3. unsigned i;
  4. unsigned n_ScalingList;
  5. int reserved_zero;
  6. Bitstream *s = p->bitstream;
  7. assert (p != NULL);
  8. assert (p->bitstream != NULL);
  9. assert (p->bitstream->streamBuffer != 0);
  10. assert (sps != NULL);
  11. p_Dec->UsedBits = 0;
  12. sps->profile_idc                            = u_v  (8, "SPS: profile_idc"                           , s);
  13. if ((sps->profile_idc!=BASELINE       ) &&
  14. (sps->profile_idc!=MAIN           ) &&
  15. (sps->profile_idc!=EXTENDED       ) &&
  16. (sps->profile_idc!=FREXT_HP       ) &&
  17. (sps->profile_idc!=FREXT_Hi10P    ) &&
  18. (sps->profile_idc!=FREXT_Hi422    ) &&
  19. (sps->profile_idc!=FREXT_Hi444    ) &&
  20. (sps->profile_idc!=FREXT_CAVLC444 )
  21. #if (MVC_EXTENSION_ENABLE)
  22. && (sps->profile_idc!=MVC_HIGH)
  23. && (sps->profile_idc!=STEREO_HIGH)
  24. #endif
  25. )
  26. {
  27. printf("Invalid Profile IDC (%d) encountered. /n", sps->profile_idc);
  28. return p_Dec->UsedBits;
  29. }
  30. sps->constrained_set0_flag                  = u_1  (   "SPS: constrained_set0_flag"                 , s);
  31. sps->constrained_set1_flag                  = u_1  (   "SPS: constrained_set1_flag"                 , s);
  32. sps->constrained_set2_flag                  = u_1  (   "SPS: constrained_set2_flag"                 , s);
  33. sps->constrained_set3_flag                  = u_1  (   "SPS: constrained_set3_flag"                 , s);
  34. #if (MVC_EXTENSION_ENABLE)
  35. sps->constrained_set4_flag                  = u_1  (   "SPS: constrained_set4_flag"                 , s);
  36. reserved_zero                               = u_v  (3, "SPS: reserved_zero_3bits"                   , s);
  37. #else
  38. reserved_zero                               = u_v  (4, "SPS: reserved_zero_4bits"                   , s);
  39. #endif
  40. assert (reserved_zero==0);
  41. sps->level_idc                              = u_v  (8, "SPS: level_idc"                             , s);
  42. sps->seq_parameter_set_id                   = ue_v ("SPS: seq_parameter_set_id"                     , s);
  43. // Fidelity Range Extensions stuff
  44. sps->chroma_format_idc = 1;
  45. sps->bit_depth_luma_minus8   = 0;
  46. sps->bit_depth_chroma_minus8 = 0;
  47. p_Vid->lossless_qpprime_flag   = 0;
  48. sps->separate_colour_plane_flag = 0;
  49. if((sps->profile_idc==FREXT_HP   ) ||
  50. (sps->profile_idc==FREXT_Hi10P) ||
  51. (sps->profile_idc==FREXT_Hi422) ||
  52. (sps->profile_idc==FREXT_Hi444) ||
  53. (sps->profile_idc==FREXT_CAVLC444)
  54. #if (MVC_EXTENSION_ENABLE)
  55. || (sps->profile_idc==MVC_HIGH)
  56. || (sps->profile_idc==STEREO_HIGH)
  57. #endif
  58. )
  59. {
  60. sps->chroma_format_idc                      = ue_v ("SPS: chroma_format_idc"                       , s);
  61. if(sps->chroma_format_idc == YUV444)
  62. {
  63. sps->separate_colour_plane_flag           = u_1  ("SPS: separate_colour_plane_flag"              , s);
  64. }
  65. sps->bit_depth_luma_minus8                  = ue_v ("SPS: bit_depth_luma_minus8"                   , s);
  66. sps->bit_depth_chroma_minus8                = ue_v ("SPS: bit_depth_chroma_minus8"                 , s);
  67. //checking;
  68. if((sps->bit_depth_luma_minus8+8 > sizeof(imgpel)*8) || (sps->bit_depth_chroma_minus8+8> sizeof(imgpel)*8))
  69. error ("Source picture has higher bit depth than imgpel data type. /nPlease recompile with larger data type for imgpel.", 500);
  70. p_Vid->lossless_qpprime_flag                  = u_1  ("SPS: lossless_qpprime_y_zero_flag"            , s);
  71. sps->seq_scaling_matrix_present_flag        = u_1  (   "SPS: seq_scaling_matrix_present_flag"       , s);
  72. if(sps->seq_scaling_matrix_present_flag)
  73. {
  74. n_ScalingList = (sps->chroma_format_idc != YUV444) ? 8 : 12;
  75. for(i=0; iseq_scaling_list_present_flag[i]   = u_1  (   "SPS: seq_scaling_list_present_flag"         , s);
  76. if(sps->seq_scaling_list_present_flag[i])
  77. {
  78. if(i<6) scaling_list="">ScalingList4x4[i], 16, &sps->UseDefaultScalingMatrix4x4Flag[i], s);
  79. else
  80. Scaling_List(sps->ScalingList8x8[i-6], 64, &sps->UseDefaultScalingMatrix8x8Flag[i-6], s);
  81. }
  82. }
  83. }
  84. }
  85. sps->log2_max_frame_num_minus4              = ue_v ("SPS: log2_max_frame_num_minus4"                , s);
  86. sps->pic_order_cnt_type                     = ue_v ("SPS: pic_order_cnt_type"                       , s);
  87. if (sps->pic_order_cnt_type == 0)
  88. sps->log2_max_pic_order_cnt_lsb_minus4 = ue_v ("SPS: log2_max_pic_order_cnt_lsb_minus4"           , s);
  89. else if (sps->pic_order_cnt_type == 1)
  90. {
  91. sps->delta_pic_order_always_zero_flag      = u_1  ("SPS: delta_pic_order_always_zero_flag"       , s);
  92. sps->offset_for_non_ref_pic                = se_v ("SPS: offset_for_non_ref_pic"                 , s);
  93. sps->offset_for_top_to_bottom_field        = se_v ("SPS: offset_for_top_to_bottom_field"         , s);
  94. sps->num_ref_frames_in_pic_order_cnt_cycle = ue_v ("SPS: num_ref_frames_in_pic_order_cnt_cycle"  , s);
  95. for(i=0; inum_ref_frames_in_pic_order_cnt_cycle; i++)
  96. sps->offset_for_ref_frame[i]               = se_v ("SPS: offset_for_ref_frame[i]"              , s);
  97. }
  98. sps->num_ref_frames                        = ue_v ("SPS: num_ref_frames"                         , s);
  99. sps->gaps_in_frame_num_value_allowed_flag  = u_1  ("SPS: gaps_in_frame_num_value_allowed_flag"   , s);
  100. sps->pic_width_in_mbs_minus1               = ue_v ("SPS: pic_width_in_mbs_minus1"                , s);
  101. sps->pic_height_in_map_units_minus1        = ue_v ("SPS: pic_height_in_map_units_minus1"         , s);
  102. sps->frame_mbs_only_flag                   = u_1  ("SPS: frame_mbs_only_flag"                    , s);
  103. if (!sps->frame_mbs_only_flag)
  104. {
  105. sps->mb_adaptive_frame_field_flag        = u_1  ("SPS: mb_adaptive_frame_field_flag"           , s);
  106. }
  107. sps->direct_8x8_inference_flag             = u_1  ("SPS: direct_8x8_inference_flag"              , s);
  108. sps->frame_cropping_flag                   = u_1  ("SPS: frame_cropping_flag"                    , s);
  109. if (sps->frame_cropping_flag)
  110. {
  111. sps->frame_cropping_rect_left_offset      = ue_v ("SPS: frame_cropping_rect_left_offset"           , s);
  112. sps->frame_cropping_rect_right_offset     = ue_v ("SPS: frame_cropping_rect_right_offset"          , s);
  113. sps->frame_cropping_rect_top_offset       = ue_v ("SPS: frame_cropping_rect_top_offset"            , s);
  114. sps->frame_cropping_rect_bottom_offset    = ue_v ("SPS: frame_cropping_rect_bottom_offset"         , s);
  115. }
  116. sps->vui_parameters_present_flag           = (Boolean) u_1  ("SPS: vui_parameters_present_flag"      , s);
  117. InitVUI(sps);
  118. ReadVUI(p, sps);
  119. sps->Valid = TRUE;
  120. return p_Dec->UsedBits;
  121. }

H.264码流第二个 NALU 是 PPS(图像参数集Picture Parameter Set)
对应H264标准文档 7.3.2.2 序列参数集的语法进行解析

PPS参数解析
[cpp] view plaincopy
  1. int InterpretPPS (VideoParameters *p_Vid, DataPartition *p, pic_parameter_set_rbsp_t *pps)
  2. {
  3. unsigned i;
  4. unsigned n_ScalingList;
  5. int chroma_format_idc;
  6. int NumberBitsPerSliceGroupId;
  7. Bitstream *s = p->bitstream;
  8. assert (p != NULL);
  9. assert (p->bitstream != NULL);
  10. assert (p->bitstream->streamBuffer != 0);
  11. assert (pps != NULL);
  12. p_Dec->UsedBits = 0;
  13. pps->pic_parameter_set_id                  = ue_v ("PPS: pic_parameter_set_id"                   , s);
  14. pps->seq_parameter_set_id                  = ue_v ("PPS: seq_parameter_set_id"                   , s);
  15. pps->entropy_coding_mode_flag              = u_1  ("PPS: entropy_coding_mode_flag"               , s);
  16. //! Note: as per JVT-F078 the following bit is unconditional.  If F078 is not accepted, then
  17. //! one has to fetch the correct SPS to check whether the bit is present (hopefully there is
  18. //! no consistency problem :-(
  19. //! The current encoder code handles this in the same way.  When you change this, don't forget
  20. //! the encoder!  StW, 12/8/02
  21. pps->bottom_field_pic_order_in_frame_present_flag                = u_1  ("PPS: bottom_field_pic_order_in_frame_present_flag"                 , s);
  22. pps->num_slice_groups_minus1               = ue_v ("PPS: num_slice_groups_minus1"                , s);
  23. // FMO stuff begins here
  24. if (pps->num_slice_groups_minus1 > 0)
  25. {
  26. pps->slice_group_map_type               = ue_v ("PPS: slice_group_map_type"                , s);
  27. if (pps->slice_group_map_type == 0)
  28. {
  29. for (i=0; i<=pps->num_slice_groups_minus1; i++)
  30. pps->run_length_minus1 [i]                  = ue_v ("PPS: run_length_minus1 [i]"              , s);
  31. }
  32. else if (pps->slice_group_map_type == 2)
  33. {
  34. for (i=0; inum_slice_groups_minus1; i++)
  35. {
  36. //! JVT-F078: avoid reference of SPS by using ue(v) instead of u(v)
  37. pps->top_left [i]                          = ue_v ("PPS: top_left [i]"                        , s);
  38. pps->bottom_right [i]                      = ue_v ("PPS: bottom_right [i]"                    , s);
  39. }
  40. }
  41. else if (pps->slice_group_map_type == 3 ||
  42. pps->slice_group_map_type == 4 ||
  43. pps->slice_group_map_type == 5)
  44. {
  45. pps->slice_group_change_direction_flag     = u_1  ("PPS: slice_group_change_direction_flag"      , s);
  46. pps->slice_group_change_rate_minus1        = ue_v ("PPS: slice_group_change_rate_minus1"         , s);
  47. }
  48. else if (pps->slice_group_map_type == 6)
  49. {
  50. if (pps->num_slice_groups_minus1+1 >4)
  51. NumberBitsPerSliceGroupId = 3;
  52. else if (pps->num_slice_groups_minus1+1 > 2)
  53. NumberBitsPerSliceGroupId = 2;
  54. else
  55. NumberBitsPerSliceGroupId = 1;
  56. pps->pic_size_in_map_units_minus1      = ue_v ("PPS: pic_size_in_map_units_minus1"               , s);
  57. if ((pps->slice_group_id = calloc (pps->pic_size_in_map_units_minus1+1, 1)) == NULL)
  58. no_mem_exit ("InterpretPPS: slice_group_id");
  59. for (i=0; i<=pps->pic_size_in_map_units_minus1; i++)
  60. pps->slice_group_id[i] = (byte) u_v (NumberBitsPerSliceGroupId, "slice_group_id[i]", s);
  61. }
  62. }
  63. // End of FMO stuff
  64. pps->num_ref_idx_l0_active_minus1          = ue_v ("PPS: num_ref_idx_l0_active_minus1"           , s);
  65. pps->num_ref_idx_l1_active_minus1          = ue_v ("PPS: num_ref_idx_l1_active_minus1"           , s);
  66. pps->weighted_pred_flag                    = u_1  ("PPS: weighted_pred_flag"                     , s);
  67. pps->weighted_bipred_idc                   = u_v  ( 2, "PPS: weighted_bipred_idc"                , s);
  68. pps->pic_init_qp_minus26                   = se_v ("PPS: pic_init_qp_minus26"                    , s);
  69. pps->pic_init_qs_minus26                   = se_v ("PPS: pic_init_qs_minus26"                    , s);
  70. pps->chroma_qp_index_offset                = se_v ("PPS: chroma_qp_index_offset"                 , s);
  71. pps->deblocking_filter_control_present_flag = u_1 ("PPS: deblocking_filter_control_present_flag" , s);
  72. pps->constrained_intra_pred_flag           = u_1  ("PPS: constrained_intra_pred_flag"            , s);
  73. pps->redundant_pic_cnt_present_flag        = u_1  ("PPS: redundant_pic_cnt_present_flag"         , s);
  74. if(more_rbsp_data(s->streamBuffer, s->frame_bitoffset,s->bitstream_length)) // more_data_in_rbsp()
  75. {
  76. //Fidelity Range Extensions Stuff
  77. pps->transform_8x8_mode_flag           = u_1  ("PPS: transform_8x8_mode_flag"                , s);
  78. pps->pic_scaling_matrix_present_flag   =  u_1  ("PPS: pic_scaling_matrix_present_flag"        , s);
  79. if(pps->pic_scaling_matrix_present_flag)
  80. {
  81. chroma_format_idc = p_Vid->SeqParSet[pps->seq_parameter_set_id].chroma_format_idc;
  82. n_ScalingList = 6 + ((chroma_format_idc != YUV444) ? 2 : 6) * pps->transform_8x8_mode_flag;
  83. for(i=0; ipic_scaling_list_present_flag[i]= u_1  ("PPS: pic_scaling_list_present_flag"          , s);
  84. if(pps->pic_scaling_list_present_flag[i])
  85. {
  86. if(i<6) scaling_list="">ScalingList4x4[i], 16, &pps->UseDefaultScalingMatrix4x4Flag[i], s);
  87. else
  88. Scaling_List(pps->ScalingList8x8[i-6], 64, &pps->UseDefaultScalingMatrix8x8Flag[i-6], s);
  89. }
  90. }
  91. }
  92. pps->second_chroma_qp_index_offset      = se_v ("PPS: second_chroma_qp_index_offset"          , s);
  93. }
  94. else
  95. {
  96. pps->second_chroma_qp_index_offset      = pps->chroma_qp_index_offset;
  97. }
  98. pps->Valid = TRUE;
  99. return p_Dec->UsedBits;
  100. }

H.264码流第三个 NALU 是 IDR(即时解码器刷新)
对应H264标准文档 7.3.3 序列参数集的语法进行解析

IDR参数解析
[cpp] view plaincopy
  1. case NALU_TYPE_IDR:
  2. img->idr_flag = (nalu->nal_unit_type == NALU_TYPE_IDR);
  3. img->nal_reference_idc = nalu->nal_reference_idc;
  4. img->disposable_flag = (nalu->nal_reference_idc == NALU_PRIORITY_DISPOSABLE);
  5. currSlice->dp_mode = PAR_DP_1;   //++ dp_mode:数据分割模式;PAR_DP_1=0:没有数据分割
  6. currSlice->max_part_nr = 1;
  7. currSlice->ei_flag = 0;  //++ 该处赋值直接影响decode_slice()函数中对decode_one_slice()函数的调用
  8. //++ 该值不为0,表明当前片出错,解码程序将忽略当前片的解码过程,而使用错误隐藏
  9. currStream = currSlice->partArr[0].bitstream;
  10. currStream->ei_flag = 0; //++ 此处的赋值为最终赋值,以后不再改变。该值将对每个宏块的ei_flag产生影响
  11. //++ 参见macroblock.c文件read_one_macroblock()函数的如下语句:
  12. //++        :if(!dP->bitstream->ei_flag)      :currMB->ei_flag = 0;
  13. //++ 该值还在macroblock.c文件if(IS_INTRA (currMB) && dP->bitstream->ei_flag && img->number)中用到
  14. currStream->frame_bitoffset = currStream->read_len = 0;
  15. memcpy (currStream->streamBuffer, &nalu->buf[1], nalu->len-1);
  16. currStream->code_len = currStream->bitstream_length = RBSPtoSODB(currStream->streamBuffer, nalu->len-1);
  17. // Some syntax of the Slice Header depends on the parameter set, which depends on
  18. // the parameter set ID of the SLice header.  Hence, read the pic_parameter_set_id
  19. // of the slice header first, then setup the active parameter sets, and then read
  20. // the rest of the slice header
  21. BitsUsedByHeader = FirstPartOfSliceHeader();    //++ 参见标准7.3.3
  22. UseParameterSet (currSlice->pic_parameter_set_id);
  23. BitsUsedByHeader+= RestOfSliceHeader ();    //++ 参见标准7.3.3
  24. //++ BitsUsedByHeader在程序中没有实际用处,而且BitsUsedByHeader+= RestOfSliceHeader ()
  25. //++ 重复计算了FirstPartOfSliceHeader()所用到的比特数。因为在FirstPartOfSliceHeader()
  26. //++ 之后,变量UsedBits值并未被置零就代入RestOfSliceHeader()运算,从而RestOfSliceHeader ()
  27. //++ 在返回时,BitsUsedByHeader+= RestOfSliceHeader()多加了一个BitsUsedByHeader值
  28. FmoInit (active_pps, active_sps);
  29. if(is_new_picture())
  30. {
  31. init_picture(img, input);
  32. current_header = SOP;
  33. //check zero_byte if it is also the first NAL unit in the access unit
  34. CheckZeroByteVCL(nalu, &ret);
  35. }
  36. else
  37. current_header = SOS;
  38. init_lists(img->type, img->currentSlice->structure);
  39. reorder_lists (img->type, img->currentSlice);
  40. if (img->structure==FRAME)
  41. {
  42. init_mbaff_lists();
  43. }
  44. /*        if (img->frame_num==1) // write a reference list
  45. {
  46. count ++;
  47. if (count==1)
  48. for (i=0; i
  49. // From here on, active_sps, active_pps and the slice header are valid
  50. if (img->MbaffFrameFlag)
  51. img->current_mb_nr = currSlice->start_mb_nr << 1="" style="color: #0000ff">else
  52. img->current_mb_nr = currSlice->start_mb_nr;
  53. if (active_pps->entropy_coding_mode_flag)
  54. {
  55. int ByteStartPosition = currStream->frame_bitoffset/8;
  56. if (currStream->frame_bitoffset%8 != 0)
  57. {
  58. ByteStartPosition++;
  59. }
  60. arideco_start_decoding (&currSlice->partArr[0].de_cabac, currStream->streamBuffer, ByteStartPosition, &currStream->read_len, img->type);
  61. }
  62. // printf ("read_new_slice: returning %s/n", current_header == SOP?"SOP":"SOS");
  63. FreeNALU(nalu);
  64. return current_header;
  65. break;
  66. case NALU_TYPE_DPA:
  67. //! The state machine here should follow the same ideas as the old readSliceRTP()
  68. //! basically:
  69. //! work on DPA (as above)
  70. //! read and process all following SEI/SPS/PPS/PD/Filler NALUs
  71. //! if next video NALU is dpB,
  72. //!   then read and check whether it belongs to DPA, if yes, use it
  73. //! else
  74. //!   ;   // nothing
  75. //! read and process all following SEI/SPS/PPS/PD/Filler NALUs
  76. //! if next video NALU is dpC
  77. //!   then read and check whether it belongs to DPA (and DPB, if present), if yes, use it, done
  78. //! else
  79. //!   use the DPA (and the DPB if present)
  80. /*
  81. LC: inserting the code related to DP processing, mainly copying some of the parts
  82. related to NALU_TYPE_SLICE, NALU_TYPE_IDR.
  83. */
  84. if(expected_slice_type != NALU_TYPE_DPA)
  85. {
  86. /* oops... we found the next slice, go back! */
  87. fseek(bits, ftell_position, SEEK_SET);
  88. FreeNALU(nalu);
  89. return current_header;
  90. }
  91. img->idr_flag          = (nalu->nal_unit_type == NALU_TYPE_IDR);
  92. img->nal_reference_idc = nalu->nal_reference_idc;
  93. img->disposable_flag   = (nalu->nal_reference_idc == NALU_PRIORITY_DISPOSABLE);
  94. currSlice->dp_mode     = PAR_DP_3;
  95. currSlice->max_part_nr = 3;
  96. currSlice->ei_flag     = 0;
  97. currStream             = currSlice->partArr[0].bitstream;
  98. currStream->ei_flag    = 0;
  99. currStream->frame_bitoffset = currStream->read_len = 0;
  100. memcpy (currStream->streamBuffer, &nalu->buf[1], nalu->len-1);
  101. currStream->code_len = currStream->bitstream_length = RBSPtoSODB(currStream->streamBuffer, nalu->len-1);    //++ 剔除停止比特和填充比特
  102. BitsUsedByHeader     = FirstPartOfSliceHeader();
  103. UseParameterSet (currSlice->pic_parameter_set_id);
  104. BitsUsedByHeader    += RestOfSliceHeader ();
  105. FmoInit (active_pps, active_sps);
  106. if(is_new_picture())
  107. {
  108. init_picture(img, input);
  109. current_header = SOP;
  110. CheckZeroByteVCL(nalu, &ret);
  111. }
  112. else
  113. current_header = SOS;
  114. init_lists(img->type, img->currentSlice->structure);
  115. reorder_lists (img->type, img->currentSlice);
  116. if (img->structure==FRAME)
  117. {
  118. init_mbaff_lists();
  119. }
  120. // From here on, active_sps, active_pps and the slice header are valid
  121. if (img->MbaffFrameFlag)
  122. img->current_mb_nr = currSlice->start_mb_nr << 1="" style="color: #0000ff">else
  123. img->current_mb_nr = currSlice->start_mb_nr;
  124. /*
  125. LC:
  126. Now I need to read the slice ID, which depends on the value of
  127. redundant_pic_cnt_present_flag (pag.49).
  128. */
  129. slice_id_a  = ue_v("NALU:SLICE_A slice_idr", currStream);
  130. if (active_pps->entropy_coding_mode_flag)
  131. {
  132. int ByteStartPosition = currStream->frame_bitoffset/8;
  133. if (currStream->frame_bitoffset%8 != 0)
  134. {
  135. ByteStartPosition++;
  136. }
  137. arideco_start_decoding (&currSlice->partArr[0].de_cabac, currStream->streamBuffer, ByteStartPosition, &currStream->read_len, img->type);
  138. }
  139. // printf ("read_new_slice: returning %s/n", current_header == SOP?"SOP":"SOS");
  140. break;
  141. case NALU_TYPE_DPB:
  142. /* LC: inserting the code related to DP processing */
  143. currStream             = currSlice->partArr[1].bitstream;
  144. currStream->ei_flag    = 0;
  145. currStream->frame_bitoffset = currStream->read_len = 0;
  146. memcpy (currStream->streamBuffer, &nalu->buf[1], nalu->len-1);
  147. currStream->code_len = currStream->bitstream_length = RBSPtoSODB(currStream->streamBuffer, nalu->len-1);
  148. slice_id_b  = ue_v("NALU:SLICE_B slice_idr", currStream);
  149. if (active_pps->redundant_pic_cnt_present_flag)
  150. redundant_pic_cnt_b = ue_v("NALU:SLICE_B redudand_pic_cnt", currStream);
  151. else
  152. redundant_pic_cnt_b = 0;
  153. /*  LC: Initializing CABAC for the current data stream. */
  154. if (active_pps->entropy_coding_mode_flag)
  155. {
  156. int ByteStartPosition = currStream->frame_bitoffset/8;
  157. if (currStream->frame_bitoffset % 8 != 0)
  158. ByteStartPosition++;
  159. arideco_start_decoding (&currSlice->partArr[1].de_cabac, currStream->streamBuffer,
  160. ByteStartPosition, &currStream->read_len, img->type);
  161. }
  162. /* LC: resilience code to be inserted */
  163. /*         FreeNALU(nalu); */
  164. /*         return current_header; */
  165. break;
IDR参数解析/*!
[cpp] view plaincopy
  1. <pre name="code" class="cpp"> ************************************************************************
  2. * /brief
  3. *    read the first part of the header (only the pic_parameter_set_id)
  4. * /return
  5. *    Length of the first part of the slice header (in bits)
  6. ************************************************************************
  7. */
  8. //++ 参见标准7.3.3
  9. int FirstPartOfSliceHeader()
  10. {
  11. Slice *currSlice = img->currentSlice;
  12. int dP_nr = assignSE2partition[currSlice->dp_mode][SE_HEADER];
  13. DataPartition *partition = &(currSlice->partArr[dP_nr]);
  14. Bitstream *currStream = partition->bitstream;
  15. int tmp;
  16. UsedBits= partition->bitstream->frame_bitoffset; // was hardcoded to 31 for previous start-code. This is better.
  17. // Get first_mb_in_slice
  18. currSlice->start_mb_nr = ue_v ("SH: first_mb_in_slice", currStream);
  19. tmp = ue_v ("SH: slice_type", currStream);
  20. if (tmp>4) tmp -=5;
  21. img->type = currSlice->picture_type = (SliceType) tmp;
  22. currSlice->pic_parameter_set_id = ue_v ("SH: pic_parameter_set_id", currStream);
  23. return UsedBits;
  24. }
  25. </pre><br><br>

H264参数语法文档: SPS、PPS、IDR相关推荐

  1. Markdown语法文档,Markdown教程,Markdown语法大全,

    写在前面 最近一段时间学习的同时也在做一些笔记,想着将笔记发布出来加深印象并能够方便查找,看了一些大佬的文章后,不得不感慨大佬们编写文章的整洁度和可读性,因此经过仔细斟酌后,只有Markdown才是用 ...

  2. 【H264码流分析】 SPS/PPS/Slice Header

    SPS中相关 H264 Profile 对视频压缩特性的描述,Profile越高,就说明采用了越高级的压缩特性 H264 Level Level是对视频的描述,Levrl越高,视频的码率,分辨率,fp ...

  3. Smali 语法文档

    可以选择保存成pdf格式,查询起来挺方便的 if v0==0 go cond_0 if-eqz v0, :cond_0 if v0!=0 go cond_0 if-nez v0, :cond_0 v1 ...

  4. Live555本地保存H264/PCM视频音频帧附加SPS/PPS

    项目用到,这里备份以后防止忘记: #include "liveMedia.hh" #include "BasicUsageEnvironment.hh"stat ...

  5. h264 sei信息 解码_关于H264编码数据中SPS,PPS,SEI,IDR等内容的问题

    群内的朋友们好! 我使用的平台是ipnc rdk 3.8 , 我在h264编码的有关NALU参数设置如下: staticParams->nalUnitControlParams.naluCont ...

  6. sps和pps一篇好的解释 H264码流中SPS PPS详解<转>

    https://blog.csdn.net/luzubodfgs/article/details/86775940 H264码流中NALU sps pps IDR帧的理解 https://blog.c ...

  7. H264--NALU/SPS/PPS

    H264结构中,一个视频图像编码后的数据叫做一帧,一帧由一个片(slice)或多个片组成,一个片由一个或多个宏块(MB)组成. H264编码过程中的三种不同的数据形式: SODB        数据比 ...

  8. H264参数SPS(序列参数集)和PPS(图像参数集)说明

    H264参数SPS(序列参数集)和PPS(图像参数集)说明 https://blog.csdn.net/heanyu/article/details/6191576 https://blog.csdn ...

  9. H264帧的分析sps pps

    帧格式 H264帧由NALU头和NALU主体组成. NALU头由一个字节组成,它的语法如下: +---------------+       |0|1|2|3|4|5|6|7|       +-+-+ ...

最新文章

  1. python 的回调函数
  2. HTML的布局的小秘密
  3. linux ubuntu/deepin与Windows时间不同步解决办法(双系统)
  4. #绘制圆心_SolidWorks2018 绘制草图轮廓练习
  5. python 学习资源收集汇总
  6. 单例设计模式-静态内部类
  7. P1119 灾后重建(floyd进阶)
  8. OC中Runtime浅析
  9. C++day14 学习笔记
  10. bde连接mysql设置,delphi通过BDE方式连接数据库以及程序Demo
  11. Atitit data fmt sumup 常用的数据交换格式 标准 目录 1. 分类标准 2 1.1. 按照结构化与非结构化分类 2 1.2. 按照资料性质分类常见的数据格式txt ,do
  12. java项目启动失败的解决方案
  13. 服务器不能用pe安装win7系统安装,WinPE无法安装win7系统的完美解决方案
  14. 多个无线 AP 怎么实现无缝漫游?
  15. 欢喜传媒2021年报:亏损收窄背后,影视行业静待春暖花开
  16. 一天上手Aurora 8B/10B IP核(4)----从Streaming接口的官方例程学起
  17. linux基础知识ppt下载,《Linux基础知识》PPT课件.ppt
  18. 使用计算机求函数极限示例
  19. mysql mmm 测试_mysql-mmm有关mmm_control 参数测试
  20. 洛谷10月月赛II题解

热门文章

  1. MS SQL 能否修改实例名称
  2. Xen的起源与工作原理
  3. 【转】全面理解javascript的arguments,callee,caller,call,apply概念(修改版)
  4. AGPM(高级组策略管理)3.0之二操作
  5. bigquery_到Google bigquery的sql查询模板,它将您的报告提升到另一个层次
  6. leetcode 767. 重构字符串(贪心算法)
  7. tailwind css_什么是Tailwind CSS,如何将其添加到我的网站或React App中?
  8. JavaScript循环:标签语句,继续语句和中断语句说明
  9. css flexbox模型_Flexbox教程:了解如何使用CSS Flexbox编写响应式导航栏
  10. BOS12——多对多添加方法,多对多页面需要字段问题(不多的话直接提供get方法),修改Realm中授权方法(查询数据库),缓存Java对象的方法,加载左侧菜单(ztree提供pId)...