Ejemplo n.º 1
0
        public void Read(BitReader bitReader)
        {
            _bitReader = bitReader;
            MBType     = _mbTypeParser.GetMacroBlockType(_bitReader);
            if (MBType > 48)
            {
                throw new Exception("MacroBlockLayer: bad macro block type");
            }
            I_MacroBlockType mbt = (I_MacroBlockType)MBType;

            if (mbt == I_MacroBlockType.I_PCM)
            {
                while (!bitReader.ByteAligned)
                {
                    if (bitReader.GetNextBit())
                    {
                        throw new Exception("MacroBlockLayer: bad alignment");
                    }
                }
                bitReader.Position += (long)(256 * ChromaFormatFactor); // skip data (don't need it)
            }
            else
            {
                byte mbtype = (byte)MBType;
                if ((MbPartPredMode(mbtype, 0) != MacroBlockPartitionMode.Intra_4x4) &&
                    (MbPartPredMode(mbtype, 0) != MacroBlockPartitionMode.Intra_16x16) &&
                    (NumMbPart(mbtype) == 4))
                {
                    SubMacroBlockPrediction smbp = new SubMacroBlockPrediction(mbtype);
                }
                else
                {
                    MacroBlockPrediction mbpred = new MacroBlockPrediction(mbtype, this);
                    mbpred.Read(bitReader);
                }
                if (MbPartPredMode(mbtype, 0) != MacroBlockPartitionMode.Intra_16x16)
                {
                    CodedBlockPattern = _cbp.GetCodedBlockPattern(bitReader);
                }
                if ((CodedBlockPatternLuma > 0) || (CodedBlockPatternChroma > 0) ||
                    (MbPartPredMode(mbtype, 0) == MacroBlockPartitionMode.Intra_16x16))
                {
                    MBQPDelta = _mbQPD.GetMBQPDelta(bitReader);
                    ResidualData residual = new ResidualData(_pps.EntropyCodingModeFlag);
                    residual.Read(bitReader);
                }
            }
        }
Ejemplo n.º 2
0
 public void Read(BitReader bitReader)
 {
     _bitReader = bitReader;
       MBType = _mbTypeParser.GetMacroBlockType(_bitReader);
       if (MBType > 48)
     throw new Exception("MacroBlockLayer: bad macro block type");
       I_MacroBlockType mbt = (I_MacroBlockType)MBType;
       if (mbt == I_MacroBlockType.I_PCM)
       {
     while (!bitReader.ByteAligned)
     {
       if (bitReader.GetNextBit())
     throw new Exception("MacroBlockLayer: bad alignment");
     }
     bitReader.Position += (long)(256 * ChromaFormatFactor); // skip data (don't need it)
       }
       else
       {
     byte mbtype = (byte)MBType;
     if ((MbPartPredMode(mbtype, 0) != MacroBlockPartitionMode.Intra_4x4) &&
       (MbPartPredMode(mbtype, 0) != MacroBlockPartitionMode.Intra_16x16) &&
       (NumMbPart(mbtype) == 4))
     {
       SubMacroBlockPrediction smbp = new SubMacroBlockPrediction(mbtype);
     }
     else
     {
       MacroBlockPrediction mbpred = new MacroBlockPrediction(mbtype, this);
       mbpred.Read(bitReader);
     }
     if (MbPartPredMode(mbtype, 0) != MacroBlockPartitionMode.Intra_16x16)
       CodedBlockPattern = _cbp.GetCodedBlockPattern(bitReader);
     if ((CodedBlockPatternLuma > 0) || (CodedBlockPatternChroma > 0) ||
       (MbPartPredMode(mbtype, 0) == MacroBlockPartitionMode.Intra_16x16))
     {
       MBQPDelta = _mbQPD.GetMBQPDelta(bitReader);
       ResidualData residual = new ResidualData(_pps.EntropyCodingModeFlag);
       residual.Read(bitReader);
     }
       }
 }