codec/h264/h264dec/naltype.go: create types for nal header extensions, and give to NalUnit type

Issue #111 on hold
Saxon Milton created an issue

currently we have the fields from the nal header extensions in the NalUnit type:

type NalUnit struct {
    NumBytes                     int
    ForbiddenZeroBit             int
    RefIdc                       int
    Type                         int
    SvcExtensionFlag             int
    Avc3dExtensionFlag           int
    IdrFlag                      int
    PriorityId                   int
    NoInterLayerPredFlag         int
    DependencyId                 int
    QualityId                    int
    TemporalId                   int
    UseRefBasePicFlag            int
    DiscardableFlag              int
    OutputFlag                   int
    ReservedThree2Bits           int
    HeaderBytes                  int
    NonIdrFlag                   int
    ViewId                       int
    AnchorPicFlag                int
    InterViewFlag                int
    ReservedOneBit               int
    ViewIdx                      int
    DepthFlag                    int
    EmulationPreventionThreeByte byte
    rbsp                         []byte
}

It’s probably better to create types for the extensions, i.e.

type SVCExtension struct {
...
}

type ThreeDAVExtension struct {
...
}

type MVCExtension struct {
...
}

Then we add these as fields to the NalUnit struct:

type NalUnit struct {
    NumBytes                     int
    ForbiddenZeroBit             int
    RefIdc                       int
    Type                         int
    SvcExtensionFlag             int
    Avc3dExtensionFlag           int
    SVCExtension                 *SVCExtension
    ThreeDAVExtension            *ThreeDAVExtension
    MVCExtension                 *MVCExtension
    rbsp                         []byte
}

These are optional, so if the fields are nil, then we consider the NalUnit not to have the particular extension.

We should also then add funcs for creating a new extension struct. e.g.

func NewSVCExtension(br *bits.BitReader) (*SVCExtension,error){
// parsing process
}

See section 7.3.1 in specifications for more information on syntax of NAL units.

Comments (2)

  1. Log in to comment