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 (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 (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 (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 add_node (struct concealment_node *)
void delete_node (struct concealment_node *)
void init_lists_for_non_reference_loss (int, PictureStructure)
void conceal_non_ref_pics (int diff)
void conceal_lost_frames (ImageParameters *img)
void sliding_window_poc_management (StorablePicture *p)
void write_lost_non_ref_pic (int poc, int p_out)
void write_lost_ref_after_idr (int pos)
int comp (const void *, const void *)

Variables

FrameStore * last_out_fs
int pocs_in_dpb [100]


Detailed Description

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

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

Definition in file erc_api.h.


Function Documentation

void add_node ( struct concealment_node *   ) 

Adds a node to the end of the list.

Definition at line 1611 of file erc_do_p.c.

Referenced by conceal_non_ref_pics().

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 1541 of file erc_do_p.c.

Referenced by conceal_non_ref_pics(), and concealByTrial().

void conceal_lost_frames ( ImageParameters *  img  ) 

void conceal_non_ref_pics ( 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 1691 of file erc_do_p.c.

References add_node(), alloc_storable_picture(), storable_picture::bottom_poc, comp(), copy_to_conceal(), storable_picture::frame_num, storable_picture::frame_poc, get_pic_from_dpb(), img, init_node(), storable_picture::poc, decoded_picture_buffer::size, storable_picture::top_poc, update_ref_list_for_concealment(), and decoded_picture_buffer::used_size.

Referenced by flush_dpb(), and store_picture_in_dpb().

Here is the call graph for this function:

void delete_node ( struct concealment_node *   ) 

Deletes the specified node pointed to by 'ptr' from the list.

Definition at line 1632 of file erc_do_p.c.

Referenced by write_lost_non_ref_pic().

void ercClose ( ercVariables_t *  errorVar  ) 

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

Parameters:
errorVar Variables for error concealment

Definition at line 174 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 80 of file erc_do_p.c.

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

Referenced by exit_picture().

Here is the call graph for this function:

int ercConcealIntraFrame ( 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:
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 42 of file erc_do_i.c.

References concealBlocks().

Referenced by exit_picture().

Here is the call graph for this function:

void ercInit ( int  pic_sizex,
int  pic_sizey,
int  flag 
)

Initinize the error concealment module.

Definition at line 33 of file erc_api.c.

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

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 351 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 277 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 315 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 54 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 89 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 207 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 230 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 257 of file erc_api.c.

Referenced by exit_picture().

void init_lists_for_non_reference_loss ( int  ,
PictureStructure   
)

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 1555 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 1593 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 1579 of file erc_do_p.c.

Referenced by print_list().

void sliding_window_poc_management ( 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 1756 of file erc_do_p.c.

References decoded_picture_buffer::size, and decoded_picture_buffer::used_size.

Referenced by store_picture_in_dpb().

void write_lost_non_ref_pic ( 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 dpb. The linked list entry corresponding to the outputted POC is immediately deleted.

Definition at line 1781 of file erc_do_p.c.

References delete_node(), frame_store::frame, img, frame_store::is_output, frame_store::is_reference, frame_store::is_used, decoded_picture_buffer::last_output_poc, 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 ( 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 1809 of file erc_do_p.c.

References alloc_storable_picture(), copy_to_conceal(), frame_store::frame, decoded_picture_buffer::fs, img, and frame_store::is_used.

Referenced by output_one_frame_from_dpb().

Here is the call graph for this function:


Documentation generated with DoxyGen