Ejemplo n.º 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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
 public H264Picture(UInt32 layerId, UInt32 index, H264PicParamSet defaultPicParamSet, H264SeqParamSet defaultSeqParamSet)
     : base(layerId, index)
 {
     m_DefaultSeqParamSet = defaultSeqParamSet;
     m_DefaultPicParamSet = defaultPicParamSet;
     m_Slices             = new Dictionary <UInt32, H264Slice>();
     m_Images             = new Bitmap[Utils.GetMaxEnumValue <CommonEltMbDataType_t>()];
     m_Md5YUV             = new String[Utils.GetMaxEnumValue <CommonEltMbDataType_t>()];
     m_Md5Y = new String[Utils.GetMaxEnumValue <CommonEltMbDataType_t>()];
     m_Md5U = new String[Utils.GetMaxEnumValue <CommonEltMbDataType_t>()];
     m_Md5V = new String[Utils.GetMaxEnumValue <CommonEltMbDataType_t>()];
 }
Ejemplo n.º 4
0
 public H264Picture(UInt32 layerId, UInt32 index, H264PicParamSet defaultPicParamSet, H264SeqParamSet defaultSeqParamSet)
     : base(layerId, index)
 {
     m_DefaultSeqParamSet = defaultSeqParamSet;
     m_DefaultPicParamSet = defaultPicParamSet;
     m_Slices = new Dictionary<UInt32, H264Slice>();
     m_Images = new Bitmap[Utils.GetMaxEnumValue<CommonEltMbDataType_t>()];
     m_Md5YUV = new String[Utils.GetMaxEnumValue<CommonEltMbDataType_t>()];
     m_Md5Y = new String[Utils.GetMaxEnumValue<CommonEltMbDataType_t>()];
     m_Md5U = new String[Utils.GetMaxEnumValue<CommonEltMbDataType_t>()];
     m_Md5V = new String[Utils.GetMaxEnumValue<CommonEltMbDataType_t>()];
 }
Ejemplo n.º 5
0
        private void AddSeqParamSet(H264SeqParamSet seqParamSet)
        {
            KeyValuePair <UInt32, IDictionary <UInt32, H264SeqParamSet> > seqParamSetsKVP = m_SeqParamSets.FirstOrDefault((x) => { return(x.Key == seqParamSet.Nalu.LayerId); });

            if (seqParamSetsKVP.Equals(default(KeyValuePair <UInt32, IDictionary <UInt32, H264SeqParamSet> >)))
            {
                IDictionary <UInt32, H264SeqParamSet> seqParamSets = new Dictionary <UInt32, H264SeqParamSet>();
                seqParamSets[seqParamSet.Id]             = seqParamSet;
                m_SeqParamSets[seqParamSet.Nalu.LayerId] = seqParamSets;
            }
            else
            {
                seqParamSetsKVP.Value[seqParamSet.Id] = seqParamSet;
            }
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
0
 private void AddSeqParamSet(H264SeqParamSet seqParamSet)
 {
     KeyValuePair<UInt32, IDictionary<UInt32, H264SeqParamSet>> seqParamSetsKVP = m_SeqParamSets.FirstOrDefault((x) => { return x.Key == seqParamSet.Nalu.LayerId; });
     if (seqParamSetsKVP.Equals(default(KeyValuePair<UInt32, IDictionary<UInt32, H264SeqParamSet>>)))
     {
         IDictionary<UInt32, H264SeqParamSet> seqParamSets = new Dictionary<UInt32, H264SeqParamSet>();
         seqParamSets[seqParamSet.Id] = seqParamSet;
         m_SeqParamSets[seqParamSet.Nalu.LayerId] = seqParamSets;
     }
     else
     {
         seqParamSetsKVP.Value[seqParamSet.Id] = seqParamSet;
     }
 }