00001
00021 #ifndef _ERC_API_H_
00022 #define _ERC_API_H_
00023
00024 #include "erc_globals.h"
00025
00026
00027
00028
00029
00030
00031
00032 #define MVPERMB_THR 8
00033
00034
00035 #define DEF_REGION_SIZE 384
00036
00037 #define ERC_BLOCK_OK 3
00038 #define ERC_BLOCK_CONCEALED 2
00039 #define ERC_BLOCK_CORRUPTED 1
00040 #define ERC_BLOCK_EMPTY 0
00041
00042
00043
00044
00045
00046
00047 #define xPosYBlock(currYBlockNum,picSizeX) \
00048 ((currYBlockNum)%((picSizeX)>>3))
00049
00050 #define yPosYBlock(currYBlockNum,picSizeX) \
00051 ((currYBlockNum)/((picSizeX)>>3))
00052
00053 #define xPosMB(currMBNum,picSizeX) \
00054 ((currMBNum)%((picSizeX)>>4))
00055
00056 #define yPosMB(currMBNum,picSizeX) \
00057 ((currMBNum)/((picSizeX)>>4))
00058
00059 #define MBxy2YBlock(currXPos,currYPos,comp,picSizeX) \
00060 ((((currYPos)<<1)+((comp)>>1))*((picSizeX)>>3)+((currXPos)<<1)+((comp)&1))
00061
00062 #define MBNum2YBlock(currMBNum,comp,picSizeX) \
00063 MBxy2YBlock(xPosMB((currMBNum),(picSizeX)),yPosMB((currMBNum),(picSizeX)),(comp),(picSizeX))
00064
00065
00066
00067
00068
00069
00070
00071 typedef struct ercSegment_s
00072 {
00073 int startMBPos;
00074 int endMBPos;
00075 int fCorrupted;
00076 } ercSegment_t;
00077
00078
00079 typedef struct ercVariables_s
00080 {
00081
00082 int nOfMBs;
00083
00084 int nOfSegments;
00085
00086
00087 int *yCondition;
00088
00089 int *uCondition;
00090
00091 int *vCondition;
00092
00093
00094 ercSegment_t *segments;
00095 int currSegment;
00096
00097
00098 int *prevFrameYCondition;
00099
00100
00101 int currSegmentCorrupted;
00102
00103 int nOfCorruptedSegments;
00104
00105
00106 int concealment;
00107
00108 } ercVariables_t;
00109
00110
00111
00112
00113
00114 void ercInit(ImageParameters *p_Img, int pic_sizex, int pic_sizey, int flag);
00115 ercVariables_t *ercOpen( void );
00116 void ercReset( ercVariables_t *errorVar, int nOfMBs, int numOfSegments, int picSizeX );
00117 void ercClose( ImageParameters *p_Img, ercVariables_t *errorVar );
00118 void ercSetErrorConcealment( ercVariables_t *errorVar, int value );
00119
00120 void ercStartSegment( int currMBNum, int segment, unsigned int bitPos, ercVariables_t *errorVar );
00121 void ercStopSegment( int currMBNum, int segment, unsigned int bitPos, ercVariables_t *errorVar );
00122 void ercMarkCurrSegmentLost(int picSizeX, ercVariables_t *errorVar );
00123 void ercMarkCurrSegmentOK(int picSizeX, ercVariables_t *errorVar );
00124 void ercMarkCurrMBConcealed( int currMBNum, int comp, int picSizeX, ercVariables_t *errorVar );
00125
00126 int ercConcealIntraFrame( ImageParameters *p_Img, frame *recfr, int picSizeX, int picSizeY, ercVariables_t *errorVar );
00127 int ercConcealInterFrame( frame *recfr, objectBuffer_t *object_list,
00128 int picSizeX, int picSizeY, ercVariables_t *errorVar, int chroma_format_idc );
00129
00130
00131
00132
00133 #include "mbuffer.h"
00134 #include "output.h"
00135
00136 struct concealment_node {
00137 StorablePicture* picture;
00138 int missingpocs;
00139 struct concealment_node *next;
00140 };
00141
00142 extern struct concealment_node * init_node(StorablePicture* , int );
00143 extern void print_node( struct concealment_node * );
00144 extern void print_list( struct concealment_node * );
00145 extern void init_lists_for_non_reference_loss(ImageParameters *p_Img, int , PictureStructure );
00146
00147 extern void conceal_non_ref_pics(ImageParameters *p_Img, int diff);
00148 extern void conceal_lost_frames(ImageParameters *p_Img);
00149
00150 extern void sliding_window_poc_management(DecodedPictureBuffer *p_Dpb, StorablePicture *p);
00151
00152 extern void write_lost_non_ref_pic(ImageParameters *p_Img, int poc, int p_out);
00153 extern void write_lost_ref_after_idr(ImageParameters *p_Img, int pos);
00154
00155 extern int comp(const void *, const void *);
00156
00157
00158 #endif
00159