#include "contributors.h"
#include <math.h>
#include <limits.h>
#include "global.h"
#include "image.h"
#include "fmo.h"
#include "annexb.h"
#include "nalu.h"
#include "parset.h"
#include "header.h"
#include "sei.h"
#include "output.h"
#include "mb_access.h"
#include "memalloc.h"
#include "macroblock.h"
#include "loopfilter.h"
#include "biaridecod.h"
#include "context_ini.h"
#include "cabac.h"
#include "vlc.h"
#include "quant.h"
#include "errorconcealment.h"
#include "erc_api.h"
Go to the source code of this file.
Functions | |
int | testEndian (void) |
static void | init_picture (ImageParameters *p_Img, Slice *currSlice, InputParameters *p_Inp) |
void | MbAffPostProc (ImageParameters *p_Img) |
static void | fill_wp_params (Slice *currSlice) |
static void | decode_slice (Slice *currSlice, int current_header) |
static void | Error_tracking (ImageParameters *p_Img) |
int | decode_one_frame (ImageParameters *p_Img) |
void | buffer2img (imgpel **imgX, unsigned char *buf, int size_x, int size_y, int symbol_size_in_bytes) |
void | calculate_frame_no (ImageParameters *p_Img, StorablePicture *p) |
void | find_snr (ImageParameters *p_Img, StorablePicture *p, int *p_ref) |
void | reorder_lists (Slice *currSlice) |
void | set_ref_pic_num (ImageParameters *p_Img) |
int | read_new_slice (Slice *currSlice) |
void | exit_picture (ImageParameters *p_Img, StorablePicture **dec_picture) |
void | ercWriteMBMODEandMV (Macroblock *currMB) |
void | init_old_slice (OldSliceParams *p_old_slice) |
void | exit_slice (Slice *currSlice, OldSliceParams *p_old_slice) |
int | is_new_picture (StorablePicture *dec_picture, Slice *currSlice, OldSliceParams *p_old_slice) |
void | frame_postprocessing (ImageParameters *p_Img) |
void | field_postprocessing (ImageParameters *p_Img) |
void | copy_dec_picture_JV (ImageParameters *p_Img, StorablePicture *dst, StorablePicture *src) |
void | decode_one_slice (Slice *currSlice) |
Definition in file image.c.
void buffer2img | ( | imgpel ** | imgX, | |
unsigned char * | buf, | |||
int | size_x, | |||
int | size_y, | |||
int | symbol_size_in_bytes | |||
) |
Convert file read buffer to source picture structure.
imgX | Pointer to image plane | |
buf | Buffer for file output | |
size_x | horizontal image size in pixel | |
size_y | vertical image size in pixel | |
symbol_size_in_bytes | number of bytes used per pel |
Definition at line 633 of file image.c.
References error(), and testEndian().
Referenced by find_snr().
void calculate_frame_no | ( | ImageParameters * | p_Img, | |
StorablePicture * | p | |||
) |
Calculate the value of frame_no.
Definition at line 733 of file image.c.
Referenced by direct_output(), and insert_picture_in_dpb().
void copy_dec_picture_JV | ( | ImageParameters * | p_Img, | |
StorablePicture * | dst, | |||
StorablePicture * | src | |||
) |
copy StorablePicture *src -> StorablePicture *dst for 4:4:4 Independent mode
Definition at line 1751 of file image.c.
References storable_picture::dec_ref_pic_marking_buffer, no_mem_exit(), and storable_picture::tone_mapping_lut.
Referenced by init_picture().
int decode_one_frame | ( | ImageParameters * | p_Img | ) |
decodes one I- or P-frame
Definition at line 540 of file image.c.
References EOS, Error_tracking(), exit_picture(), linfo_cbp_inter_normal(), linfo_cbp_inter_other(), linfo_cbp_intra_normal(), linfo_cbp_intra_other(), read_new_slice(), and SOP.
Referenced by main().
void decode_one_slice | ( | Slice * | currSlice | ) |
decodes one slice
Definition at line 1815 of file image.c.
References change_plane_JV(), compute_colocated(), compute_colocated_JV(), decode_one_macroblock(), ercWriteMBMODEandMV(), exit_macroblock(), exit_slice(), slice::num_ref_idx_l0_active, slice::num_ref_idx_l1_active, set_ref_pic_num(), setup_slice_methods(), slice::slice_type, and start_macroblock().
void ercWriteMBMODEandMV | ( | Macroblock * | currMB | ) |
write the encoding mode and motion vectors of current MB to the buffer of the error concealment module.
Definition at line 1493 of file image.c.
References storable_picture::motion, pic_motion_params::mv, object_buffer::mv, macroblock::p_Img, pic_motion_params::ref_idx, object_buffer::regionMode, REGMODE_INTER_COPY, REGMODE_INTER_PRED, and REGMODE_INTRA.
Referenced by decode_one_slice().
static void Error_tracking | ( | ImageParameters * | p_Img | ) | [static] |
Error tracking: if current frame is lost or any reference frame of current frame is lost, current frame is incorrect.
Definition at line 503 of file image.c.
References slice::num_ref_idx_l0_active.
Referenced by decode_one_frame().
void exit_picture | ( | ImageParameters * | p_Img, | |
StorablePicture ** | dec_picture | |||
) |
finish decoding of a picture, conceal errors and store it into the DPB
this is always true at the beginning of a picture
mark the start of the first segment
generate the segments according to the macroblock map
stop current segment
mark current segment as lost or OK
next segment
start new segment
save start MB for this segment
mark end of the last segment
call the right error concealment function depending on the frame type.
Definition at line 1290 of file image.c.
References change_plane_JV(), DeblockPicture(), ercConcealInterFrame(), ercConcealIntraFrame(), ercMarkCurrSegmentLost(), ercMarkCurrSegmentOK(), ercStartSegment(), ercStopSegment(), field_postprocessing(), frame_postprocessing(), make_frame_picture_JV(), store_picture_in_dpb(), and YUV400.
Referenced by activate_sps(), decode_one_frame(), and init_picture().
void exit_slice | ( | Slice * | currSlice, | |
OldSliceParams * | p_old_slice | |||
) |
save slice parameters that are needed for checking of "first VCL NAL unit of a picture"
Definition at line 1616 of file image.c.
References slice::Co_located_JV, free_colocated(), slice::pic_parameter_set_id, and slice::slice_type.
Referenced by decode_one_slice().
void field_postprocessing | ( | ImageParameters * | p_Img | ) |
Prepare field and frame buffer after field decoding.
Definition at line 1737 of file image.c.
Referenced by exit_picture().
void find_snr | ( | ImageParameters * | p_Img, | |
StorablePicture * | p, | |||
int * | p_ref | |||
) |
Find PSNR for all three components.Compare decoded frame with the original sequence. Read p_Inp->jumpd frames to reflect frame skipping.
p_Img | image encoding parameters for current picture | |
p | picture to be compared | |
p_ref | file pointer piont to reference YUV reference file |
Definition at line 761 of file image.c.
References buffer2img(), storable_picture::imgUV, storable_picture::imgY, no_mem_exit(), and YUV400.
Referenced by direct_output(), and insert_picture_in_dpb().
void frame_postprocessing | ( | ImageParameters * | p_Img | ) |
Prepare field and frame buffer after frame decoding.
Definition at line 1727 of file image.c.
Referenced by exit_picture().
void init_old_slice | ( | OldSliceParams * | p_old_slice | ) |
static void init_picture | ( | ImageParameters * | p_Img, | |
Slice * | currSlice, | |||
InputParameters * | p_Inp | |||
) | [static] |
Initializes the parameters for a new picture.
Definition at line 67 of file image.c.
References alloc_storable_picture(), conceal_lost_frames(), copy_dec_picture_JV(), decode_poc(), ercReset(), error(), exit_picture(), fill_frame_num_gap(), get_mb_block_pos_mbaff(), get_mb_block_pos_normal(), getAffNeighbour(), getNonAffNeighbour(), no_mem_exit(), and set_ec_flag().
Referenced by read_new_slice().
int is_new_picture | ( | StorablePicture * | dec_picture, | |
Slice * | currSlice, | |||
OldSliceParams * | p_old_slice | |||
) |
detect if current slice is "first VCL NAL unit of a picture"
Definition at line 1676 of file image.c.
References slice::pic_parameter_set_id.
Referenced by read_new_slice().
int read_new_slice | ( | Slice * | currSlice | ) |
Reads new slice from bit_stream.
Definition at line 967 of file image.c.
References alloc_colocated(), AllocNALU(), arideco_start_decoding(), assign_quant_params(), Bitstream::bitstream_length, nalu_t::buf, slice::Co_located_JV, Bitstream::code_len, slice::dp_mode, slice::dpB_NotPresent, slice::dpC_NotPresent, Bitstream::ei_flag, slice::ei_flag, EOS, error(), FirstPartOfSliceHeader(), fmo_init(), Bitstream::frame_bitoffset, free_colocated(), FreeNALU(), init_lists(), init_mbaff_lists(), init_picture(), InterpretSEIMessage(), is_new_picture(), nalu_t::len, nalu_t::lost_packets, MAX_CODED_FRAME_SIZE, nalu_t::nal_reference_idc, nalu_t::nal_unit_type, PAR_DP_1, PAR_DP_3, slice::partArr, slice::pic_parameter_set_id, RBSPtoSODB(), Bitstream::read_len, read_next_nalu(), RestOfSliceHeader(), slice::slice_type, SOP, SOS, slice::start_mb_nr, Bitstream::streamBuffer, and ue_v().
Referenced by decode_one_frame().
void set_ref_pic_num | ( | ImageParameters * | p_Img | ) |
initialize ref_pic_num array
Definition at line 918 of file image.c.
Referenced by decode_one_slice().
int testEndian | ( | void | ) |
checks if the System is big- or little-endian
Definition at line 64 of file input.c.
Referenced by buf2img_bitshift(), buffer2img(), initInput(), and initOutput().