videoeditorengine/h263decoder/inc/core.h
changeset 0 951a5db380a0
equal deleted inserted replaced
-1:000000000000 0:951a5db380a0
       
     1 /*
       
     2 * Copyright (c) 2010 Ixonos Plc.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 * Ixonos Plc
       
    14 *
       
    15 * Description:  
       
    16 * Internal header for the core module of the Video Decoder Core.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef _CORE_H_
       
    22 #define _CORE_H_
       
    23 
       
    24 #include "vdcmvc.h"
       
    25 #include "vdcaic.h"
       
    26 #include "vdeims.h"
       
    27 #include "viddemux.h"
       
    28 
       
    29 #include "biblin.h"
       
    30 
       
    31 
       
    32 /*
       
    33  * Defines
       
    34  */
       
    35 
       
    36 #define vdcMalloc malloc
       
    37 #define vdcCalloc calloc
       
    38 #define vdcRealloc realloc
       
    39 #define vdcDealloc free
       
    40 
       
    41 #ifndef vdcAssert
       
    42 #define vdcAssert(exp) assert(exp);
       
    43 #endif
       
    44 
       
    45 
       
    46 /*
       
    47  * Structs and typedefs
       
    48  */
       
    49 
       
    50 /* {{-output"vdcPictureParam_t_info.txt" -ignore"*" -noCR}}
       
    51    vdcPictureParam_t is used to store the attributes for one picture.
       
    52    {{-output"vdcPictureParam_t_info.txt"}} */
       
    53 
       
    54 /* {{-output"vdcPictureParam_t.txt"}} */
       
    55 typedef struct {
       
    56    int tr;                    /* the TR field or a combination of ETR and TR
       
    57                                  if ETR is used */
       
    58 
       
    59    int trd;                   /* Difference between present and previous tr */
       
    60 
       
    61    int prevTR;                /* TR of the previous frame */
       
    62 
       
    63    /* The following three fields correspond to the flags in the PTYPE field */
       
    64    int fSplitScreenIndicator;
       
    65    int fDocumentCameraIndicator;
       
    66    int fFullPictureFreezeRelease;
       
    67 
       
    68    int pictureType;           /* Picture type is one of the following:
       
    69                                     VDX_PIC_TYPE_I       INTRA
       
    70                                     VDX_PIC_TYPE_P       INTER
       
    71                                     VDX_PIC_TYPE_PB      PB (Annex G)
       
    72                                     VDX_PIC_TYPE_IPB     Improved PB
       
    73                                     VDX_PIC_TYPE_B       B (Annex O)
       
    74                                     VDX_PIC_TYPE_EI      EI (Annex O)
       
    75                                     VDX_PIC_TYPE_EP      EP (Annex O) */
       
    76 
       
    77    int fPLUSPTYPE;            /* 0 = no PLUSPTYPE, 1 = PLUSPTYPE exists */
       
    78 
       
    79    int cpm;                   /* The CPM field */
       
    80    int psbi;                  /* The PSBI field, valid only if cpm == 1 */
       
    81 
       
    82    /* The following two fields are relevant if picture type indicates
       
    83       a PB frame */
       
    84    int trb;                   /* The TRB field */
       
    85    int dbquant;               /* The DBQUANT field */
       
    86 
       
    87    int lumWidth;              /* the width and height of the luminance */
       
    88    int lumHeight;             /* image to display (divisible with 4) */
       
    89 
       
    90    int lumMemWidth;           /* the width and height of the luminance */
       
    91    int lumMemHeight;          /* image in memory (divisible with 16) */
       
    92 
       
    93    /* The following six fields are relevant only if fSS is off */
       
    94    int numGOBs;               /* Number of GOBs in picture */
       
    95    int fLastGOBSizeDifferent; /* Flag indicating different size of last GOB */
       
    96    int numMBsInGOB;           /* Number of macroblocks in other GOBs than 
       
    97                                  the last one */
       
    98    int numMBsInLastGOB;       /* Number of macroblocks in last GOB */
       
    99    int numMBLinesInGOB;       /* Number of macroblock lines in one GOB */
       
   100    int numMBsInMBLine;        /* Number of macroblocks in macroblock line */
       
   101 
       
   102    /* The following six fields are relevant only if fSS is on */
       
   103    int mbaFieldWidth;         /* MBA Field width */
       
   104    int mbaMaxValue;           /* MBA maximum value. See Table K.2/H.263 */
       
   105    int swiFieldWidth;         /* SWI Field width */
       
   106    int swiMaxValue;           /* SWI maximum value. See Table K.3/H.263 */
       
   107 
       
   108    int fUMV;                  /* Unrestricted Motion Vector Mode */
       
   109    int fSAC;                  /* Syntax-based Arithmetic Coding Mode */
       
   110    int fAP;                   /* Advanced Prediction Mode */
       
   111 
       
   112    int fRPR;                  /* Reference Picture Resampling Mode */
       
   113    int fRRU;                  /* Reduced-Resolution Update Mode */
       
   114    int rtype;                 /* Rounding type (RTYPE) */
       
   115 
       
   116    int elnum;                 /* Enhancement layer number */
       
   117 
       
   118    int fCustomSourceFormat;   /* Flag indicating if custom source format 
       
   119                                  is used */
       
   120 
       
   121    int fAIC;                  /* Advanced INTRA Coding Mode */
       
   122    int fDF;                   /* Deblocking Filter Mode */
       
   123    int fSS;                   /* Slice Structured Mode */
       
   124    int fRPS;                  /* Reference Picture Selection Mode,
       
   125                                  Note: always valid and therefore should be
       
   126                                  the same as instance->fRPS after decoding
       
   127                                  the first picture header. */
       
   128    int fISD;                  /* Independent Segment Decoding Mode */
       
   129    int fAIV;                  /* Alternate INTER VLC Mode */
       
   130    int fMQ;                   /* Modified Quantization Mode */
       
   131 
       
   132                               /* Picture Clock Frequence (PCF) fields */
       
   133    int fCustomPCF;            /* 0 = CIF PCF, 1 = custom PCF */
       
   134    int pcfRate;               /* PCF = pcfRate / pcfScale Hz */
       
   135    int pcfScale;
       
   136 
       
   137    /* The following field is relevant only if fUMV is on with fPLUSPTYPE */
       
   138    int fUMVLimited;           /* 0 = motion vector range is not limited,
       
   139                                  1 = motion vector range is limited
       
   140                                     according to Annex D */
       
   141 
       
   142    int fMVsOverPictureBoundaries;
       
   143                               /* 0 = prediction over picture boundaries is 
       
   144                                      disallowed,
       
   145                                  1 = prediction over picture boundaries is
       
   146                                      allowed */
       
   147 
       
   148    /* The MPEG-4 Video Object Layer (VOL) parameters */
       
   149 /*** MPEG-4 REVISION ***/
       
   150 
       
   151    int vo_id;                 /* VO Id */
       
   152    int vol_id;                /* VO Id */
       
   153 
       
   154    u_char error_res_disable;  /* VOL disable error resilence mode */
       
   155    u_char reversible_vlc;     /* VOL reversible VLCs */
       
   156    u_char data_partitioned;   /* VOL data partitioning */
       
   157 
       
   158    int time_increment_resolution; /* resolution of the time increment
       
   159                                      in the VOP header */
       
   160 
       
   161    /* The in H.263 not existing MPEG-4 Video Object Plane (VOP) parameters */
       
   162    
       
   163    int mod_time_base;         /* VOP modulo time base (absolute) */
       
   164    int time_base_incr;        /* time base increment of the current VOP
       
   165                                  (used in HEC of Video Packet Header,
       
   166                                  when time_base_incr of the VOP is
       
   167                                  retransmitted */
       
   168    int time_inc;              /* VOP time increment 
       
   169                                  (relative to last mod_time_base) */ 
       
   170    int intra_dc_vlc_thr;
       
   171    int fcode_forward;
       
   172    u_char fixed_vop_rate;       /* fixed vop rate indication, added for transcoding */
       
   173 /*** End MPEG-4 REVISION ***/
       
   174 
       
   175 } vdcPictureParam_t;
       
   176 /* {{-output"vdcPictureParam_t.txt"}} */
       
   177 
       
   178 
       
   179 /* {{-output"vdcInstance_t_info.txt" -ignore"*" -noCR}}
       
   180    vdcInstance_t holds the instance data for a Video Decoder Core instance.
       
   181    This structure is used to keep track of the internal state of
       
   182    a VDC instance.
       
   183    {{-output"vdcInstance_t_info.txt"}} */
       
   184 
       
   185 /* {{-output"vdcInstance_t.txt"}} */
       
   186 typedef struct {
       
   187    vdeImsItem_t *currFrame;   /* Current P/I frame (image store item) */
       
   188    vdeImsItem_t *bFrame;      /* Current B frame (of PB, image store item) */
       
   189                               /* NULL pointer indicates that the frames are
       
   190                                  not valid. */
       
   191 
       
   192    vdcPictureParam_t pictureParam;
       
   193                               /* Picture parameters for the current picture */
       
   194 
       
   195    int32 frameNum;            /* Frame number */
       
   196    int32 frameNumForBFrame;   /* Frame number for B frame */
       
   197 
       
   198    int gfid;                  /* GOB Frame ID */
       
   199    vdxPictureHeader_t *prevPicHeader;  /* Header of the previous picture */
       
   200    int fPrevPicHeaderReliable;	/* if header is not 100% reliable, it is better not to compare it with the next header */
       
   201 
       
   202    mvcData_t mvcData;         /* Storage for motion vector data */
       
   203 
       
   204 /*** MPEG-4 REVISION ***/
       
   205 
       
   206    aicData_t aicData;         /* Storage AC/DC reconstruction*/
       
   207 
       
   208    char *user_data;           /* User Data */
       
   209    int user_data_length; 
       
   210 
       
   211 /*** End MPEG-4 REVISION ***/
       
   212 
       
   213    u_int32 nOfDecodedFrames;  /* Counter for (partially) successfully decoded frames */
       
   214    u_char fIntraGot;          /* non-zero = INTRA frame has been decoded */
       
   215    u_char fEOS;               /* 1 if EOS has been reached, 0 otherwise */
       
   216 
       
   217    int fRPS;                  /* Reference Picture Selection in use? 
       
   218                                  At first, set to zero in vdcOpen.
       
   219                                  Then, modified according to the bitstream. */
       
   220 
       
   221    int rpsMode;               /* both/either/neither ACK and/or/nor NACK, 
       
   222                                  VDX_RPS_MODE_XXX */
       
   223 
       
   224    int fIgnoreRPSBufferUpdate;/* 0 = segment buffering in FIFO mode as normally
       
   225                                  1 = decoded pictures are not put into
       
   226                                      reference segment buffers */
       
   227 
       
   228    int numAnnexNScalabilityLayers;
       
   229                               /* -1  = no frames decoded yet,
       
   230                                  0   = Nokia-proprietary Annex N scalability 
       
   231                                        layers not in use,
       
   232                                  2.. = number of scalability layers */
       
   233 
       
   234    int fGFIDShouldChange;     /* 1, if GFID should change, 0 otherwise */
       
   235 
       
   236    vdeIms_t *imageStore;      /* Pointer to image store */
       
   237 
       
   238    void *hParent;             /* typeless handle to vdeInstance_t */
       
   239 
       
   240    u_int32 snapshotStartCallback;  /* function pointer to a function informing   w
       
   241                                       the beginning of a snapshot */
       
   242 
       
   243    u_int32 snapshotEndCallback;  /* function pointer to a function informing
       
   244                                       the end of a snapshot */
       
   245 
       
   246    int snapshotStatus;           /* snapshot transmission status */
       
   247 
       
   248    u_int32 reportPictureSizeCallback; /* callback function for informing
       
   249                                          frame size */
       
   250 
       
   251 } vdcInstance_t;
       
   252 /* {{-output"vdcInstance_t.txt"}} */
       
   253 
       
   254 
       
   255 /*
       
   256  * Function prototypes
       
   257  */
       
   258 
       
   259 VDC_INLINE int VDC_MIN(int a, int b) {return a < b ? a : b;}
       
   260 VDC_INLINE int VDC_MAX(int a, int b) {return a > b ? a : b;}
       
   261 
       
   262 
       
   263 #endif
       
   264 
       
   265 // End of file