Пример #1
0
        public H264Slice(EltH264Nalu nalu, H264Decoder decoder)
            : base(nalu)
        {
            switch (nalu.NaluType)
            {
                case NalUnitType.NAL_UNIT_CODED_SLICE:
                case NalUnitType.NAL_UNIT_AUX_CODED_SLICE:
                case NalUnitType.NAL_UNIT_CODED_SLICE_DATAPART_A:
                case NalUnitType.NAL_UNIT_CODED_SLICE_DATAPART_B:
                case NalUnitType.NAL_UNIT_CODED_SLICE_DATAPART_C:
                case NalUnitType.NAL_UNIT_CODED_SLICE_IDR:
                case NalUnitType.NAL_UNIT_CODED_SLICE_SCALABLE:
                    break;
                default:
                    throw new NotImplementedException();
            }

            EltSyntax eltSyntax;

            eltSyntax = nalu.FindSyntax("pic_parameter_set_id");
            Debug.Assert(eltSyntax != null);
            m_PicParamSetId = (UInt32)eltSyntax.Value;
            m_PicParamSet = decoder.FindPicParamSet(m_PicParamSetId);
            Debug.Assert(m_PicParamSet != null);
            m_SeqParamSet = m_PicParamSet.SeqParamSet;
            Debug.Assert(m_SeqParamSet != null);

            m_Macroblocs = new Dictionary<UInt32, Macroblock>();
            ExplodeMacroblocs(nalu);
        }
Пример #2
0
        public H264SeqParamSet(EltH264Nalu nalu)
            : base(nalu)
        {
            EltSyntax eltSyntax;
            Debug.Assert(nalu.NaluType == NalUnitType.NAL_UNIT_SPS || nalu.NaluType == NalUnitType.NAL_UNIT_SUBSET_SPS);

            eltSyntax = nalu.FindSyntax("seq_parameter_set_id");
            Debug.Assert(eltSyntax != null);
            m_Id = (UInt32)eltSyntax.Value;

            eltSyntax = nalu.FindSyntax("pic_width_in_mbs_minus1");
            Debug.Assert(eltSyntax != null);
            m_Width = ((UInt32)eltSyntax.Value << 4) + 16;

            eltSyntax = nalu.FindSyntax("pic_height_in_map_units_minus1");
            Debug.Assert(eltSyntax != null);
            m_Height = ((UInt32)eltSyntax.Value << 4) + 16;

            m_SizeInMbs = (m_Width * m_Height) >> 8;
        }
Пример #3
0
        public H264PicParamSet(EltH264Nalu nalu, H264Decoder decoder)
            : base(nalu)
        {
            EltSyntax eltSyntax;
            Debug.Assert(nalu.NaluType == NalUnitType.NAL_UNIT_PPS);

            eltSyntax = nalu.FindSyntax("pic_parameter_set_id");
            Debug.Assert(eltSyntax != null);
            m_Id = (UInt32)eltSyntax.Value;

            eltSyntax = nalu.FindSyntax("seq_parameter_set_id");
            Debug.Assert(eltSyntax != null);
            m_SeqParamSetId = (UInt32)eltSyntax.Value;

            eltSyntax = nalu.FindSyntax("entropy_coding_mode_flag");
            Debug.Assert(eltSyntax != null);
            m_IsCAVLCEncoded = (eltSyntax.Value == 0);

            m_SeqParamSet = decoder.FindSeqParamSet(nalu.LayerId, m_SeqParamSetId);
            Debug.Assert(m_SeqParamSet != null);
        }
Пример #4
0
 public H264Nalu(EltH264Nalu nalu)
 {
     m_Nalu = nalu;
 }