videoeditorengine/h263decoder/inc/block.h
branchRCL_3
changeset 3 e0b5df5c0969
parent 0 951a5db380a0
child 5 4c409de21d23
equal deleted inserted replaced
0:951a5db380a0 3:e0b5df5c0969
     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 * Block handling.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef _BLOCK_H_
       
    22 #define _BLOCK_H_
       
    23 
       
    24 #include "epoclib.h"
       
    25 #include "vdcmvc.h"
       
    26 
       
    27 /*
       
    28  * Definitions
       
    29  */
       
    30 
       
    31 
       
    32 
       
    33 /*
       
    34  * Structs and typedefs
       
    35  */
       
    36 
       
    37 /* {{-output"blcDiffMB_t_info.txt" -ignore"*" -noCR}}
       
    38    blcDiffMB_t is used as a temporary storage for the previous difference 
       
    39    (INTER) macroblock. This storage is needed for the Advanced Prediction
       
    40    mode because the previous prediction macroblock cannot be constructed
       
    41    until the motion vectors of the current macroblock have been fetched
       
    42    from the bitstream. (The previous difference macroblock cannot be stored
       
    43    directly to the current frame either, because the difference block data
       
    44    is signed and the frame data is unsigned.)
       
    45    {{-output"blcDiffMB_t_info.txt"}} */
       
    46 
       
    47 /* {{-output"blcDiffMB_t.txt"}} */
       
    48 typedef struct {
       
    49    int block[4][64];    /* luminance blocks for P frame */
       
    50    int cbpy;            /* coded block pattern for luminance */
       
    51 } blcDiffMB_t;
       
    52 /* {{-output"blcDiffMB_t.txt"}} */
       
    53 
       
    54 
       
    55 /* {{-output"BLC_COPY_PREDICTION_MB_PARAM_info.txt" -ignore"*" -noCR}}
       
    56    This C preprocessor definition is used to store the parameters needed
       
    57    for the blcCopyPredictionMB function (and therefore also for
       
    58    the blcCopyPredictionMBParam_t data type). These parameters may also be used
       
    59    in other modules than the Block Tools and in other data structures than
       
    60    blcCopyPredictionMBParam_t. When these parameters are introduced with this
       
    61    preprocessor definition in the other data structures, one does not need
       
    62    the "extra" reference step which would be needed if the parameters
       
    63    would have been introduced directly and only in
       
    64    the blcCopyPredictionMBParam_t structure. For example, if otherStructA
       
    65    has been typedefd as {BLC_COPY_PREDICTION_MB_PARAM} and otherStructB as
       
    66    {blcCopyPredictionMBParam_t predPar;}, to access e.g. refY one has to use
       
    67    either otherStructA.refY or otherStructB.predPar.refY.
       
    68    {{-output"BLC_COPY_PREDICTION_MB_PARAM_info.txt"}} */
       
    69 
       
    70 /* {{-output"BLC_COPY_PREDICTION_MB_PARAM.txt"}} */
       
    71 #define BLC_COPY_PREDICTION_MB_PARAM \
       
    72    u_char *refY;              /* Reference frame */ \
       
    73    u_char *refU; \
       
    74    u_char *refV; \
       
    75 \
       
    76    u_char *currYMBInFrame;    /* Pointer to current macroblock in frame */ \
       
    77    u_char *currUBlkInFrame; \
       
    78    u_char *currVBlkInFrame; \
       
    79 \
       
    80    int uvBlkXCoord;           /* X coord of MB in chrominance pixels */ \
       
    81    int uvBlkYCoord;           /* Y coord of MB (top-left corner) in */ \
       
    82                               /* chrominance pixels */ \
       
    83 \
       
    84    int uvWidth;               /* Width of the picture in chro pixels */ \
       
    85    int uvHeight;              /* Height of the picture in chro pixels */ \
       
    86 \
       
    87    mvcData_t *mvcData;        /* Motion Vector Count module instance data */ \
       
    88 \
       
    89    int *mvx;                  /* Array of 4 x-components of motion vectors */ \
       
    90    int *mvy;                  /* Array of 4 y-components of motion vectors */ \
       
    91                               /* If not in 4-MVs-mode, only the first entry */ \
       
    92                               /* of the both arrays is used. */ \
       
    93 \
       
    94    int mbPlace;               /* Indicates the place of the current */ \
       
    95                               /* macroblock inside the macroblock row: */ \
       
    96                               /*    -1 beginning of row */ \
       
    97                               /*    0 middle of row */ \
       
    98                               /*    1 end of row */ \
       
    99                               /* If Annex K is in use */ \
       
   100                               /*    -1 beginning of row or slice */ \
       
   101                               /*    0 middle of slice */ \
       
   102                               /*    1 end of row(if not the beginning of */ \
       
   103                               /*      the slice)  or slice */ \
       
   104                               /*    2  end of row and the beginning of slice */ \
       
   105 \
       
   106    int fAdvancedPrediction;   /* Non-zero if Advanced Prediction is used */ \
       
   107 \
       
   108    int fMVsOverPictureBoundaries; \
       
   109                               /* Non-zero if MVs are allowed to point */ \
       
   110                               /* outside picture boundaries */ \
       
   111 \
       
   112    blcDiffMB_t *diffMB;       /* Prediction error for the previous MB */ \
       
   113 \
       
   114    int rcontrol;              /* RCONTROL (section 6.1.2 of H.263) */ \
       
   115 \
       
   116    int fourMVs;               /* Flag to indicate if there is four motion
       
   117                                  vectors per macroblock */
       
   118 /* {{-output"BLC_COPY_PREDICTION_MB_PARAM.txt"}} */
       
   119 
       
   120 
       
   121 /* {{-output"blcCopyPredictionMBParam_t_info.txt" -ignore"*" -noCR}}
       
   122    This structure is used to pass parameters into the blcCopyPredictionMB
       
   123    function.
       
   124    {{-output"blcCopyPredictionMBParam_t_info.txt"}} */
       
   125 
       
   126 /* {{-output"blcCopyPredictionMBParam_t.txt"}} */
       
   127 typedef struct {
       
   128    BLC_COPY_PREDICTION_MB_PARAM
       
   129 } blcCopyPredictionMBParam_t;
       
   130 /* {{-output"blcCopyPredictionMBParam_t.txt"}} */
       
   131 
       
   132 
       
   133 
       
   134 
       
   135 /*
       
   136  * Function prototypes
       
   137  */
       
   138 
       
   139 void blcAddBlock(int *block, 
       
   140 								 u_char HUGE *frame_p, 
       
   141 								 int xSize, 
       
   142    int mbPlace, u_char fourMVs, int *prevDiffBlock);
       
   143 
       
   144 void blcBlockToFrame(int *block, 
       
   145 										 u_char HUGE *frame_p, 
       
   146 										 int xSize);
       
   147 
       
   148 int blcCopyPredictionMB(blcCopyPredictionMBParam_t *param);
       
   149 
       
   150 
       
   151 
       
   152 #endif
       
   153 
       
   154 // End of file