erc_api.h File Reference

External (still inside video decoder) interface for error concealment module. More...

#include "erc_globals.h"
#include "mbuffer.h"
#include "output.h"

Include dependency graph for erc_api.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ercSegment_s
struct  ercVariables_s
struct  concealment_node

Defines

#define MVPERMB_THR   8
#define DEF_REGION_SIZE   384
#define ERC_BLOCK_OK   3
#define ERC_BLOCK_CONCEALED   2
#define ERC_BLOCK_CORRUPTED   1
#define ERC_BLOCK_EMPTY   0
#define xPosYBlock(currYBlockNum, picSizeX)   ((currYBlockNum)%((picSizeX)>>3))
#define yPosYBlock(currYBlockNum, picSizeX)   ((currYBlockNum)/((picSizeX)>>3))
#define xPosMB(currMBNum, picSizeX)   ((currMBNum)%((picSizeX)>>4))
#define yPosMB(currMBNum, picSizeX)   ((currMBNum)/((picSizeX)>>4))
#define MBxy2YBlock(currXPos, currYPos, comp, picSizeX)   ((((currYPos)<<1)+((comp)>>1))*((picSizeX)>>3)+((currXPos)<<1)+((comp)&1))
#define MBNum2YBlock(currMBNum, comp, picSizeX)   MBxy2YBlock(xPosMB((currMBNum),(picSizeX)),yPosMB((currMBNum),(picSizeX)),(comp),(picSizeX))

Typedefs

typedef struct ercSegment_s ercSegment_t
typedef struct ercVariables_s ercVariables_t

Functions

void ercInit (ImageParameters *p_Img, int pic_sizex, int pic_sizey, int flag)
ercVariables_t * ercOpen (void)
void ercReset (ercVariables_t *errorVar, int nOfMBs, int numOfSegments, int picSizeX)
void ercClose (ImageParameters *p_Img, ercVariables_t *errorVar)
void ercSetErrorConcealment (ercVariables_t *errorVar, int value)
void ercStartSegment (int currMBNum, int segment, unsigned int bitPos, ercVariables_t *errorVar)
void ercStopSegment (int currMBNum, int segment, unsigned int bitPos, ercVariables_t *errorVar)
void ercMarkCurrSegmentLost (int picSizeX, ercVariables_t *errorVar)
void ercMarkCurrSegmentOK (int picSizeX, ercVariables_t *errorVar)
void ercMarkCurrMBConcealed (int currMBNum, int comp, int picSizeX, ercVariables_t *errorVar)
int ercConcealIntraFrame (ImageParameters *p_Img, frame *recfr, int picSizeX, int picSizeY, ercVariables_t *errorVar)
int ercConcealInterFrame (frame *recfr, objectBuffer_t *object_list, int picSizeX, int picSizeY, ercVariables_t *errorVar, int chroma_format_idc)
struct concealment_node * init_node (StorablePicture *, int)
void print_node (struct concealment_node *)
void print_list (struct concealment_node *)
void init_lists_for_non_reference_loss (ImageParameters *p_Img, int, PictureStructure)
void conceal_non_ref_pics (ImageParameters *p_Img, int diff)
void conceal_lost_frames (ImageParameters *p_Img)
void sliding_window_poc_management (DecodedPictureBuffer *p_Dpb, StorablePicture *p)
void write_lost_non_ref_pic (ImageParameters *p_Img, int poc, int p_out)
void write_lost_ref_after_idr (ImageParameters *p_Img, int pos)
int comp (const void *, const void *)


Detailed Description

External (still inside video decoder) interface for error concealment module.

Author:
************************************************************************

Definition in file erc_api.h.


Function Documentation

int comp ( const void *  ,
const void *   
)

Function to sort the POC and find the lowest number in the POC list Compare the integers.

Definition at line 1570 of file erc_do_p.c.

Referenced by conceal_non_ref_pics(), and concealByTrial().

void conceal_lost_frames ( ImageParameters *  p_Img  ) 

This function conceals a missing reference frame. The routine is called based on the difference in frame number. It conceals an IDR frame loss based on the sudden decrease in frame number.

Definition at line 1284 of file erc_do_p.c.

References alloc_storable_picture(), copy_prev_pic_to_concealed_pic(), flush_dpb(), and store_picture_in_dpb().

Referenced by init_picture().

Here is the call graph for this function:

void conceal_non_ref_pics ( ImageParameters *  p_Img,
int  diff 
)

Stores the missing non reference frames in the concealment buffer. The detection is based on the POC difference in the sorted POC array. A missing non reference frame is detected when the dpb is full. A singly linked list is maintained for storing the missing non reference frames.

Definition at line 1720 of file erc_do_p.c.

References add_node(), alloc_storable_picture(), comp(), copy_to_conceal(), get_pic_from_dpb(), init_node(), and update_ref_list_for_concealment().

Referenced by flush_dpb(), and store_picture_in_dpb().

Here is the call graph for this function:

void ercClose ( ImageParameters *  p_Img,
ercVariables_t *  errorVar 
)

Resets the variables used in error detection. Should be called always when starting to decode a new frame.

Parameters:
p_Img ImageParameters variable
errorVar Variables for error concealment

Definition at line 171 of file erc_api.c.

Referenced by ercInit(), and main().

int ercConcealInterFrame ( frame recfr,
objectBuffer_t object_list,
int  picSizeX,
int  picSizeY,
ercVariables_t *  errorVar,
int  chroma_format_idc 
)

The main function for Inter (P) frame concealment.

Returns:
0, if the concealment was not successful and simple concealment should be used 1, otherwise (even if none of the blocks were concealed)
Parameters:
recfr Reconstructed frame buffer
object_list Motion info for all MBs in the frame
picSizeX Width of the frame in pixels
picSizeY Height of the frame in pixels
errorVar Variables for error concealment
chroma_format_idc Chroma format IDC

Definition at line 74 of file erc_do_p.c.

References concealByCopy(), concealByTrial(), ercCollect8PredBlocks(), ercMarkCurrMBConcealed(), no_mem_exit(), and YUV400.

Referenced by exit_picture().

Here is the call graph for this function:

int ercConcealIntraFrame ( ImageParameters *  p_Img,
frame recfr,
int  picSizeX,
int  picSizeY,
ercVariables_t *  errorVar 
)

The main function for Intra frame concealment. Calls "concealBlocks" for each color component (Y,U,V) separately.

Returns:
0, if the concealment was not successful and simple concealment should be used 1, otherwise (even if none of the blocks were concealed)
Parameters:
p_Img image encoding parameters for current picture
recfr Reconstructed frame buffer
picSizeX Width of the frame in pixels
picSizeY Height of the frame in pixels
errorVar Variables for error concealment

Definition at line 44 of file erc_do_i.c.

References concealBlocks().

Referenced by exit_picture().

Here is the call graph for this function:

void ercInit ( ImageParameters *  p_Img,
int  pic_sizex,
int  pic_sizey,
int  flag 
)

Initinize the error concealment module.

Definition at line 28 of file erc_api.c.

References ercClose(), ercOpen(), ercSetErrorConcealment(), and no_mem_exit().

Referenced by activate_sps().

Here is the call graph for this function:

void ercMarkCurrMBConcealed ( int  currMBNum,
int  comp,
int  picSizeX,
ercVariables_t *  errorVar 
)

Marks the Blocks of the given component (YUV) of the current MB as concealed.

Parameters:
currMBNum Selects the segment where this MB number is in.
comp Component to mark (0:Y, 1:U, 2:V, <0:All)
picSizeX Width of the frame in pixels.
errorVar Variables for error detector

Definition at line 348 of file erc_api.c.

Referenced by ercConcealInterFrame().

void ercMarkCurrSegmentLost ( int  picSizeX,
ercVariables_t *  errorVar 
)

Marks the current segment (the one which has the "currMBNum" MB in it) as lost: all the blocks of the MBs in the segment as corrupted.

Parameters:
picSizeX Width of the frame in pixels.
errorVar Variables for error detector

Definition at line 274 of file erc_api.c.

Referenced by exit_picture().

void ercMarkCurrSegmentOK ( int  picSizeX,
ercVariables_t *  errorVar 
)

Marks the current segment (the one which has the "currMBNum" MB in it) as OK: all the blocks of the MBs in the segment as OK.

Parameters:
picSizeX Width of the frame in pixels.
errorVar Variables for error detector

Definition at line 312 of file erc_api.c.

Referenced by exit_picture().

ercVariables_t* ercOpen ( void   ) 

Allocates data structures used in error concealment.

Returns:
The allocated ercVariables_t is returned.

Definition at line 49 of file erc_api.c.

References no_mem_exit().

Referenced by ercInit().

Here is the call graph for this function:

void ercReset ( ercVariables_t *  errorVar,
int  nOfMBs,
int  numOfSegments,
int  picSizeX 
)

Resets the variables used in error detection. Should be called always when starting to decode a new frame.

Parameters:
errorVar Variables for error concealment
nOfMBs Number of macroblocks in a frame
numOfSegments Estimated number of segments (memory reserved)
picSizeX Width of the frame in pixels.

mark segments as corrupted

Definition at line 84 of file erc_api.c.

References no_mem_exit().

Referenced by init_picture().

Here is the call graph for this function:

void ercSetErrorConcealment ( ercVariables_t *  errorVar,
int  value 
)

Sets error concealment ON/OFF. Can be invoked only between frames, not during a frame.

Parameters:
errorVar Variables for error concealment
value New value

Definition at line 204 of file erc_api.c.

Referenced by ercInit().

void ercStartSegment ( int  currMBNum,
int  segment,
unsigned int  bitPos,
ercVariables_t *  errorVar 
)

Creates a new segment in the segment-list, and marks the start MB and bit position. If the end of the previous segment was not explicitly marked by "ercStopSegment", also marks the end of the previous segment. If needed, it reallocates the segment-list for a larger storage place.

Parameters:
currMBNum The MB number where the new slice/segment starts
segment Segment/Slice No. counted by the caller
bitPos Bitstream pointer: number of bits read from the buffer.
errorVar Variables for error detector

Definition at line 227 of file erc_api.c.

Referenced by exit_picture().

void ercStopSegment ( int  currMBNum,
int  segment,
unsigned int  bitPos,
ercVariables_t *  errorVar 
)

Marks the end position of a segment.

Parameters:
currMBNum The last MB number of the previous segment
segment Segment/Slice No. counted by the caller If (segment<0) the internal segment counter is used.
bitPos Bitstream pointer: number of bits read from the buffer.
errorVar Variables for error detector

Changed TO 12.11.2001

Definition at line 254 of file erc_api.c.

Referenced by exit_picture().

void init_lists_for_non_reference_loss ( ImageParameters *  p_Img,
int  ,
PictureStructure   
)

Initialize the list based on the B frame or non reference 'p' frame to be concealed. The function initialize p_Img->listX[0] and list 1 depending on current picture type.

Definition at line 1400 of file erc_do_p.c.

References compare_pic_by_lt_pic_num_asc(), compare_pic_by_pic_num_desc(), compare_pic_by_poc_asc(), and compare_pic_by_poc_desc().

Referenced by copy_to_conceal().

Here is the call graph for this function:

struct concealment_node* init_node ( StorablePicture ,
int   
) [read]

Initialises a node, allocates memory for the node, and returns a pointer to the new node.

Definition at line 1584 of file erc_do_p.c.

Referenced by conceal_non_ref_pics().

void print_list ( struct concealment_node *   ) 

Prints all nodes from the current address passed to it.

Definition at line 1622 of file erc_do_p.c.

References print_node().

Here is the call graph for this function:

void print_node ( struct concealment_node *   ) 

Prints the details of a node.

Definition at line 1608 of file erc_do_p.c.

Referenced by print_list().

void sliding_window_poc_management ( DecodedPictureBuffer p_Dpb,
StorablePicture p 
)

Perform Sliding window decoded reference picture marking process. It maintains the POC s stored in the dpb at a specific instance.

Definition at line 1786 of file erc_do_p.c.

Referenced by store_picture_in_dpb().

void write_lost_non_ref_pic ( ImageParameters *  p_Img,
int  poc,
int  p_out 
)

Outputs the non reference frames. The POCs in the concealment buffer are sorted in ascending order and outputted when the lowest POC in the concealment buffer is lower than the lowest in the p_Dpb-> The linked list entry corresponding to the outputted POC is immediately deleted.

Definition at line 1812 of file erc_do_p.c.

References delete_node(), frame_store::is_reference, frame_store::is_used, and write_stored_frame().

Referenced by output_one_frame_from_dpb().

Here is the call graph for this function:

void write_lost_ref_after_idr ( ImageParameters *  p_Img,
int  pos 
)

Conceals frame loss immediately after the IDR. This special case produces the same result for either frame copy or motion vector copy concealment.

Definition at line 1841 of file erc_do_p.c.

References alloc_storable_picture(), and copy_to_conceal().

Referenced by output_one_frame_from_dpb().

Here is the call graph for this function:


Documentation generated with DoxyGen