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


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] |
************************************************************************
Definition in file erc_api.h.
| 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 | ) |
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 1260 of file erc_do_p.c.
References storable_picture::adaptive_ref_pic_buffering_flag, alloc_storable_picture(), storable_picture::bottom_poc, storable_picture::coded_frame, storable_picture::concealed_pic, copy_prev_pic_to_concealed_pic(), flush_dpb(), storable_picture::frame_num, storable_picture::frame_poc, storable_picture::idr_flag, storable_picture::is_output, storable_picture::non_existing, storable_picture::pic_num, storable_picture::poc, ref_flag, storable_picture::slice_type, store_picture_in_dpb(), storable_picture::top_poc, and storable_picture::used_for_reference.
Referenced by init_picture().

| 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().

| 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 | ) |
| 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.
| 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().

| 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.
| 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().

| 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().

| 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.
| 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.
| 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.
| 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.
Definition at line 54 of file erc_api.c.
References no_mem_exit().
Referenced by ercInit().

| 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.
| 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().

| void ercSetErrorConcealment | ( | ercVariables_t * | errorVar, | |
| int | value | |||
| ) |
| 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.
| 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.
| 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 | ||||
| ) |
Initialize the list based on the B frame or non reference 'p' frame to be concealed. The function initialize listX[0] and list 1 depending on current picture type.
Definition at line 1374 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(), compare_pic_by_poc_desc(), frame_store::concealment_reference, frame_store::frame, frame_store::frame_num, frame_store::frame_num_wrap, decoded_picture_buffer::fs, decoded_picture_buffer::fs_ref, img, storable_picture::pic_num, storable_picture::poc, decoded_picture_buffer::ref_frames_in_buffer, and decoded_picture_buffer::used_size.
Referenced by copy_to_conceal().

| 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().

| 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().

| 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().
