OpenCores
URL https://opencores.org/ocsvn/bluespec-h264/bluespec-h264/trunk

Subversion Repositories bluespec-h264

[/] [bluespec-h264/] [trunk/] [test/] [decoder/] [ldecod/] [inc/] [erc_api.h] - Blame information for rev 100

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jamey.hick
 
2
/*!
3
 ************************************************************************
4
 * \file  erc_api.h
5
 *
6
 * \brief
7
 *      External (still inside video decoder) interface for error concealment module
8
 *
9
 * \author
10
 *      - Ari Hourunranta                <ari.hourunranta@nokia.com>
11
 *      - Ye-Kui Wang                   <wyk@ieee.org>
12
 *      - Jill Boyce                     <jill.boyce@thomson.net>
13
 *      - Saurav K Bandyopadhyay         <saurav@ieee.org>
14
 *      - Zhenyu Wu                      <Zhenyu.Wu@thomson.net
15
 *      - Purvin Pandit                  <Purvin.Pandit@thomson.net>
16
 *
17
 * ************************************************************************
18
 */
19
 
20
 
21
#ifndef _ERC_API_H_
22
#define _ERC_API_H_
23
 
24
#include "erc_globals.h"
25
 
26
/*
27
* Defines
28
*/
29
 
30
/* If the average motion vector of the correctly received macroblocks is less than the
31
threshold, concealByCopy is used, otherwise concealByTrial is used. */
32
#define MVPERMB_THR 8
33
 
34
/* used to determine the size of the allocated memory for a temporal Region (MB) */
35
#define DEF_REGION_SIZE 384  /* 8*8*6 */
36
 
37
#define ERC_BLOCK_OK                3
38
#define ERC_BLOCK_CONCEALED         2
39
#define ERC_BLOCK_CORRUPTED         1
40
#define ERC_BLOCK_EMPTY             0
41
 
42
#define mabs(a) ( (a) < 0 ? -(a) : (a) )
43
#define mmax(a,b) ((a) > (b) ? (a) : (b))
44
#define mmin(a,b) ((a) < (b) ? (a) : (b))
45
 
46
/*
47
* Functions to convert MBNum representation to blockNum
48
*/
49
 
50
#define xPosYBlock(currYBlockNum,picSizeX) \
51
((currYBlockNum)%((picSizeX)>>3))
52
 
53
#define yPosYBlock(currYBlockNum,picSizeX) \
54
((currYBlockNum)/((picSizeX)>>3))
55
 
56
#define xPosMB(currMBNum,picSizeX) \
57
((currMBNum)%((picSizeX)>>4))
58
 
59
#define yPosMB(currMBNum,picSizeX) \
60
((currMBNum)/((picSizeX)>>4))
61
 
62
#define MBxy2YBlock(currXPos,currYPos,comp,picSizeX) \
63
((((currYPos)<<1)+((comp)>>1))*((picSizeX)>>3)+((currXPos)<<1)+((comp)&1))
64
 
65
#define MBNum2YBlock(currMBNum,comp,picSizeX) \
66
MBxy2YBlock(xPosMB((currMBNum),(picSizeX)),yPosMB((currMBNum),(picSizeX)),(comp),(picSizeX))
67
 
68
 
69
/*
70
* typedefs
71
*/
72
 
73
/* segment data structure */
74
typedef struct ercSegment_s
75
{
76
  int      startMBPos;
77
  int      endMBPos;
78
  int      fCorrupted;
79
} ercSegment_t;
80
 
81
/* Error detector & concealment instance data structure */
82
typedef struct ercVariables_s
83
{
84
  /*  Number of macroblocks (size or size/4 of the arrays) */
85
  int   nOfMBs;
86
  /* Number of segments (slices) in frame */
87
  int     nOfSegments;
88
 
89
  /*  Array for conditions of Y blocks */
90
  int     *yCondition;
91
  /*  Array for conditions of U blocks */
92
  int     *uCondition;
93
  /*  Array for conditions of V blocks */
94
  int     *vCondition;
95
 
96
  /* Array for Slice level information */
97
  ercSegment_t *segments;
98
  int     currSegment;
99
 
100
  /* Conditions of the MBs of the previous frame */
101
  int   *prevFrameYCondition;
102
 
103
  /* Flag telling if the current segment was found to be corrupted */
104
  int   currSegmentCorrupted;
105
  /* Counter for corrupted segments per picture */
106
  int   nOfCorruptedSegments;
107
 
108
  /* State variables for error detector and concealer */
109
  int   concealment;
110
 
111
} ercVariables_t;
112
 
113
/*
114
* External function interface
115
*/
116
 
117
void ercInit(int pic_sizex, int pic_sizey, int flag);
118
ercVariables_t *ercOpen( void );
119
void ercReset( ercVariables_t *errorVar, int nOfMBs, int numOfSegments, int picSizeX );
120
void ercClose( ercVariables_t *errorVar );
121
void ercSetErrorConcealment( ercVariables_t *errorVar, int value );
122
 
123
void ercStartSegment( int currMBNum, int segment, unsigned int bitPos, ercVariables_t *errorVar );
124
void ercStopSegment( int currMBNum, int segment, unsigned int bitPos, ercVariables_t *errorVar );
125
void ercMarkCurrSegmentLost(int picSizeX, ercVariables_t *errorVar );
126
void ercMarkCurrSegmentOK(int picSizeX, ercVariables_t *errorVar );
127
void ercMarkCurrMBConcealed( int currMBNum, int comp, int picSizeX, ercVariables_t *errorVar );
128
 
129
int ercConcealIntraFrame( frame *recfr, int picSizeX, int picSizeY, ercVariables_t *errorVar );
130
int ercConcealInterFrame( frame *recfr, objectBuffer_t *object_list,
131
                          int picSizeX, int picSizeY, ercVariables_t *errorVar, int chroma_format_idc );
132
 
133
 
134
/* Thomson APIs for concealing entire frame loss */
135
 
136
#include "mbuffer.h"
137
#include "output.h"
138
 
139
struct concealment_node {
140
    StorablePicture* picture;
141
    int  missingpocs;
142
    struct concealment_node *next;
143
};
144
 
145
struct concealment_node * init_node(StorablePicture* , int );
146
void print_node( struct concealment_node * );
147
void print_list( struct concealment_node * );
148
void add_node( struct concealment_node * );
149
void delete_node( struct concealment_node * );
150
void init_lists_for_non_reference_loss(int , PictureStructure );
151
 
152
void conceal_non_ref_pics(int diff);
153
void conceal_lost_frames(ImageParameters *img);
154
 
155
void sliding_window_poc_management(StorablePicture *p);
156
 
157
void write_lost_non_ref_pic(int poc, int p_out);
158
void write_lost_ref_after_idr(int pos);
159
 
160
FrameStore *last_out_fs;
161
int pocs_in_dpb[100];
162
int comp(const void *, const void *);
163
 
164
 
165
#endif
166
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.