Exemple #1
0
        public static void readExtension(MemoryStream bb, SequenceHeader sh)
        {
            m_hasExtensions = true;

            BitReader inb     = new BitReader(bb);
            int       extType = inb.readNBit(4);

            switch (extType)
            {
            case Sequence_Extension:
                sh.sequenceExtension = SequenceExtension.read(inb);
                break;

            case Sequence_Scalable_Extension:
                sh.sequenceScalableExtension = SequenceScalableExtension.read(inb);
                break;

            case Sequence_Display_Extension:
                sh.sequenceDisplayExtension = SequenceDisplayExtension.read(inb);
                break;

            default:
                throw new Exception("Unsupported extension: " + extType);
            }
        }
        public static SequenceScalableExtension read(BitReader inb)
        {
            SequenceScalableExtension sse = new SequenceScalableExtension();

            sse.scalable_mode = inb.readNBit(2);
            sse.layer_id      = inb.readNBit(4);

            if (sse.scalable_mode == SPATIAL_SCALABILITY)
            {
                sse.lower_layer_prediction_horizontal_size = inb.readNBit(14);
                inb.read1Bit();
                sse.lower_layer_prediction_vertical_size = inb.readNBit(14);
                sse.horizontal_subsampling_factor_m      = inb.readNBit(5);
                sse.horizontal_subsampling_factor_n      = inb.readNBit(5);
                sse.vertical_subsampling_factor_m        = inb.readNBit(5);
                sse.vertical_subsampling_factor_n        = inb.readNBit(5);
            }

            if (sse.scalable_mode == TEMPORAL_SCALABILITY)
            {
                sse.picture_mux_enable = inb.read1Bit();
                if (sse.picture_mux_enable != 0)
                {
                    sse.mux_to_progressive_sequence = inb.read1Bit();
                }
                sse.picture_mux_order  = inb.readNBit(3);
                sse.picture_mux_factor = inb.readNBit(3);
            }

            return(sse);
        }
Exemple #3
0
 public static MBType[] mbTypeVal(int picture_coding_type, SequenceScalableExtension sse)
 {
     if (sse != null && sse.scalable_mode == SequenceScalableExtension.SNR_SCALABILITY)
     {
         return(mbTypeValSNR);
     }
     else if (sse != null && sse.scalable_mode == SequenceScalableExtension.SPATIAL_SCALABILITY)
     {
         return(picture_coding_type == PictureHeader.IntraCoded ? mbTypeValISpat
             : (picture_coding_type == PictureHeader.PredictiveCoded ? mbTypeValPSpat : mbTypeValBSpat));
     }
     else
     {
         return(picture_coding_type == PictureHeader.IntraCoded ? mbTypeValI
             : (picture_coding_type == PictureHeader.PredictiveCoded ? mbTypeValP : mbTypeValB));
     }
 }
Exemple #4
0
 public static VLC vlcMBType(int picture_coding_type, SequenceScalableExtension sse)
 {
     if (sse != null && sse.scalable_mode == SequenceScalableExtension.SNR_SCALABILITY)
     {
         return(vlcMBTypeSNR);
     }
     else if (sse != null && sse.scalable_mode == SequenceScalableExtension.SPATIAL_SCALABILITY)
     {
         return(picture_coding_type == PictureHeader.IntraCoded ? vlcMBTypeISpat
             : (picture_coding_type == PictureHeader.PredictiveCoded ? vlcMBTypePSpat : vlcMBTypeBSpat));
     }
     else
     {
         return(picture_coding_type == PictureHeader.IntraCoded ? vlcMBTypeI
             : (picture_coding_type == PictureHeader.PredictiveCoded ? vlcMBTypeP : vlcMBTypeB));
     }
 }
Exemple #5
0
 public void copyExtensions(SequenceHeader sh)
 {
     sequenceExtension         = sh.sequenceExtension;
     sequenceScalableExtension = sh.sequenceScalableExtension;
     sequenceDisplayExtension  = sh.sequenceDisplayExtension;
 }