├── rtp_loss ├── rtp_loss.h ├── ReadMe.txt └── Makefile ├── bin ├── leakybucketrate.cfg ├── foreman_part_qcif.yuv ├── foreman_part_qcif_422.yuv ├── foreman_part_qcif_444.yuv ├── sg0conf.cfg ├── sg2conf.cfg ├── HM-like │ └── per-sequence_JM │ │ ├── BQMall.cfg │ │ ├── BQSquare.cfg │ │ ├── Cactus.cfg │ │ ├── Kimono.cfg │ │ ├── Vidyo1.cfg │ │ ├── Vidyo3.cfg │ │ ├── Vidyo4.cfg │ │ ├── BQTerrace.cfg │ │ ├── ChinaSpeed.cfg │ │ ├── ParkScene.cfg │ │ ├── PartyScene.cfg │ │ ├── RaceHorsesC.cfg │ │ ├── SlideShow.cfg │ │ ├── Traffic.cfg │ │ ├── RaceHorses.cfg │ │ ├── SlideEditing.cfg │ │ ├── BasketballDrill.cfg │ │ ├── BasketballDrive.cfg │ │ ├── BasketballPass.cfg │ │ ├── BlowingBubbles.cfg │ │ ├── PeopleOnStreet.cfg │ │ ├── BasketballDrillText.cfg │ │ ├── NebutaFestival_10bit.cfg │ │ └── SteamLocomotiveTrain_10bit.cfg ├── q_matrix2.cfg ├── q_matrix_def.cfg ├── ToneMapping.cfg ├── explicit_seq.cfg ├── decoder.cfg └── decoder_stereo.cfg ├── CHANGES.TXT ├── ldecod ├── src │ ├── vlc.c │ ├── ldecod.c │ ├── mb_read.c │ ├── macroblock.c │ ├── intra_pred_common.c │ └── dec_statistics.c └── inc │ ├── biaridecod.h │ ├── contributors.h │ ├── loop_filter.h │ ├── loopfilter.h │ ├── context_ini.h │ ├── errorconcealment.h │ ├── header.h │ ├── transform8x8.h │ ├── leaky_bucket.h │ ├── nalu.h │ ├── intra8x8_pred.h │ ├── intra16x16_pred.h │ ├── filehandle.h │ ├── intra4x4_pred.h │ ├── fmo.h │ ├── output.h │ ├── annexb.h │ ├── dec_statistics.h │ ├── h264decoder.h │ ├── mc_prediction.h │ ├── mbuffer_mvc.h │ ├── image.h │ ├── erc_do.h │ ├── erc_globals.h │ ├── rtp.h │ └── mb_prediction.h ├── doc ├── coding_style.doc ├── foot.html ├── JM Reference Software Manual.doc ├── JM Reference Software Manual.pdf └── doxygen.txt ├── lcommon ├── src │ ├── io_tiff.c │ ├── win32.c │ ├── nalucommon.c │ └── blk_prediction.c └── inc │ ├── mv_prediction.h │ ├── lagrangian.h │ ├── io_raw.h │ ├── img_process_types.h │ ├── io_tiff.h │ ├── img_process.h │ ├── report.h │ ├── fast_memory.h │ ├── distortion.h │ ├── blk_prediction.h │ ├── input.h │ ├── resize.h │ ├── img_io.h │ ├── transform.h │ ├── quant_params.h │ ├── config_common.h │ ├── io_image.h │ ├── mb_access.h │ ├── typedefs.h │ ├── io_video.h │ └── vui_params.h ├── lencod ├── inc │ ├── contributors.h │ ├── loop_filter.h │ ├── me_fullfast_otf.h │ ├── pred_struct_adapt_types.h │ ├── pred_struct_adapt.h │ ├── img_dist_snr.h │ ├── img_chroma.h │ ├── header.h │ ├── macroblock_p444.h │ ├── wp_random.h │ ├── wp_periodic.h │ ├── wp_mciter.h │ ├── annexb.h │ ├── cconv_yuv2rgb.h │ ├── q_offsets.h │ ├── filehandle.h │ ├── explicit_gop.h │ ├── rd_intra_jm444.h │ ├── intrarefresh.h │ ├── img_dist_ssim.h │ ├── nalu.h │ ├── nal.h │ ├── img_dist_ms_ssim.h │ ├── q_matrix.h │ ├── me_epzs_int.h │ ├── context_ini.h │ ├── rd_intra_jm.h │ ├── hme_distortion.h │ ├── img_distortion.h │ ├── lambda.h │ ├── intra4x4.h │ ├── errdo_dist_mhyp.h │ ├── mode_decision_p8x8.h │ ├── leaky_bucket.h │ ├── output.h │ ├── quant8x8.h │ ├── q_around.h │ ├── explicit_seq.h │ ├── md_distortion.h │ ├── intra8x8.h │ ├── symbol.h │ ├── refbuf_otf.h │ ├── me_fullsearch.h │ ├── mmco.h │ ├── intra16x16.h │ ├── md_common.h │ ├── fmo.h │ ├── ratectl.h │ ├── rdopt_coding_state.h │ ├── me_fullfast.h │ ├── slice.h │ ├── wp_lms.h │ ├── wp.h │ ├── pred_struct.h │ ├── img_luma.h │ ├── list_reorder.h │ ├── wp_mcprec.h │ ├── me_epzs.h │ ├── lln_mc_prediction.h │ ├── mc_prediction.h │ ├── me_distortion_otf.h │ ├── conformance.h │ ├── quantChroma.h │ ├── rtp.h │ ├── transform8x8.h │ ├── block.h │ ├── quant4x4.h │ ├── biariencode.h │ └── parset.h └── src │ ├── symbol.c │ ├── quant8x8.c │ ├── quant4x4.c │ ├── quantChroma.c │ └── rdpicdecision.c ├── unixprep.sh ├── COPYRIGHT_ISO_IEC.txt ├── disclaimer.txt ├── Makefile ├── rtpdump ├── ReadMe.txt ├── Makefile └── rtpdump.cpp └── COPYRIGHT_ITU.txt /rtp_loss/rtp_loss.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bin/leakybucketrate.cfg: -------------------------------------------------------------------------------- 1 | 400000 2 | 300000 3 | -------------------------------------------------------------------------------- /CHANGES.TXT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shihuade/JM/HEAD/CHANGES.TXT -------------------------------------------------------------------------------- /ldecod/src/vlc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shihuade/JM/HEAD/ldecod/src/vlc.c -------------------------------------------------------------------------------- /doc/coding_style.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shihuade/JM/HEAD/doc/coding_style.doc -------------------------------------------------------------------------------- /ldecod/src/ldecod.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shihuade/JM/HEAD/ldecod/src/ldecod.c -------------------------------------------------------------------------------- /ldecod/src/mb_read.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shihuade/JM/HEAD/ldecod/src/mb_read.c -------------------------------------------------------------------------------- /lcommon/src/io_tiff.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shihuade/JM/HEAD/lcommon/src/io_tiff.c -------------------------------------------------------------------------------- /ldecod/inc/biaridecod.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shihuade/JM/HEAD/ldecod/inc/biaridecod.h -------------------------------------------------------------------------------- /ldecod/src/macroblock.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shihuade/JM/HEAD/ldecod/src/macroblock.c -------------------------------------------------------------------------------- /bin/foreman_part_qcif.yuv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shihuade/JM/HEAD/bin/foreman_part_qcif.yuv -------------------------------------------------------------------------------- /ldecod/inc/contributors.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shihuade/JM/HEAD/ldecod/inc/contributors.h -------------------------------------------------------------------------------- /ldecod/inc/loop_filter.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shihuade/JM/HEAD/ldecod/inc/loop_filter.h -------------------------------------------------------------------------------- /lencod/inc/contributors.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shihuade/JM/HEAD/lencod/inc/contributors.h -------------------------------------------------------------------------------- /lencod/inc/loop_filter.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shihuade/JM/HEAD/lencod/inc/loop_filter.h -------------------------------------------------------------------------------- /bin/foreman_part_qcif_422.yuv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shihuade/JM/HEAD/bin/foreman_part_qcif_422.yuv -------------------------------------------------------------------------------- /bin/foreman_part_qcif_444.yuv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shihuade/JM/HEAD/bin/foreman_part_qcif_444.yuv -------------------------------------------------------------------------------- /bin/sg0conf.cfg: -------------------------------------------------------------------------------- 1 | 24 2 | 20 3 | 10 4 | 15 5 | 6 | 7 | 8 | each line contains one run_length_minus1 9 | 10 | -------------------------------------------------------------------------------- /doc/foot.html: -------------------------------------------------------------------------------- 1 |
2 | Documentation generated with DoxyGen
3 | -------------------------------------------------------------------------------- /doc/JM Reference Software Manual.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shihuade/JM/HEAD/doc/JM Reference Software Manual.doc -------------------------------------------------------------------------------- /doc/JM Reference Software Manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shihuade/JM/HEAD/doc/JM Reference Software Manual.pdf -------------------------------------------------------------------------------- /bin/sg2conf.cfg: -------------------------------------------------------------------------------- 1 | 24 2 | 122 3 | 58 4 | 108 5 | 6 | 7 | 8 | odd number of rows: top left mapunit number 9 | even number of rows: bottom right of mapunit number 10 | 11 | 12 | -------------------------------------------------------------------------------- /lencod/src/symbol.c: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | *************************************************************************** 4 | * 5 | * \file symbol.c 6 | * 7 | * \brief 8 | * Generic Symbol writing interface 9 | * 10 | * \date 11 | * 18 Jan 2006 12 | * 13 | * \author 14 | * Karsten Suehring 15 | **************************************************************************/ 16 | 17 | #include "global.h" 18 | #include "symbol.h" 19 | -------------------------------------------------------------------------------- /doc/doxygen.txt: -------------------------------------------------------------------------------- 1 | Doxygen usage information 2 | ------------------------- 3 | 4 | Doxygen can be downloaded from http://www.doxygen.org 5 | 6 | Note: for generating graphs you will also need "dot" which is part of 7 | the ATT Graphviz tools available at 8 | http://www.graphviz.org/ 9 | 10 | 11 | For generation of the TML reference software documentation run 12 | 13 | doxygen lencod.dox 14 | doxygen ldecod.dox 15 | 16 | in this directory. 17 | 18 | The documentation will be genrated into the directories lenc/ and ldec/ 19 | -------------------------------------------------------------------------------- /lencod/inc/me_fullfast_otf.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ***************************************************************************************** 3 | * \file 4 | * me_fullfast_otf.h 5 | * 6 | * \brief 7 | * Headerfile for Fast Full Search motion estimation extention on-the-fly interpolation 8 | ***************************************************************************************** 9 | */ 10 | 11 | 12 | #ifndef _ME_FULLFAST_OTF_H_ 13 | #define _ME_FULLFAST_OTF_H_ 14 | 15 | void SetupFastFullPelSearch_otf (Macroblock *, MEBlock *, int ) ; 16 | 17 | #endif 18 | 19 | -------------------------------------------------------------------------------- /lencod/inc/pred_struct_adapt_types.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * pred_struct_adapt_types.h 5 | * 6 | * \author 7 | * Athanasios Leontaris 8 | * 9 | * \date 10 | * July 21, 2009 11 | * 12 | * \brief 13 | * Header file for adaptive prediction structure types 14 | ************************************************************************** 15 | */ 16 | 17 | #ifndef _PRED_STRUCT_ADAPT_TYPES_H_ 18 | #define _PRED_STRUCT_ADAPT_TYPES_H_ 19 | 20 | 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /ldecod/inc/loopfilter.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************ 3 | * \file 4 | * loopfilter.h 5 | * \brief 6 | * external deblocking filter interface 7 | ************************************************************************ 8 | */ 9 | 10 | #ifndef _LOOPFILTER_H_ 11 | #define _LOOPFILTER_H_ 12 | 13 | #include "global.h" 14 | #include "mbuffer.h" 15 | 16 | extern void DeblockPicture(VideoParameters *p_Vid, StorablePicture *p) ; 17 | 18 | void init_Deblock(VideoParameters *p_Vid, int mb_aff_frame_flag); 19 | #endif //_LOOPFILTER_H_ 20 | -------------------------------------------------------------------------------- /lencod/inc/pred_struct_adapt.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * pred_struct_adapt.h 5 | * 6 | * \author 7 | * Athanasios Leontaris 8 | * 9 | * \date 10 | * July 21, 2009 11 | * 12 | * \brief 13 | * Header file for adaptive prediction structure function headers 14 | ************************************************************************** 15 | */ 16 | 17 | #ifndef _PRED_STRUCT_ADAPT_H_ 18 | #define _PRED_STRUCT_ADAPT_H_ 19 | 20 | #include "global.h" 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /rtp_loss/ReadMe.txt: -------------------------------------------------------------------------------- 1 | This programm can be used to simulate packet loss on RTP files. The C random number 2 | generator is used for selecting the packets. The random number generator is not 3 | initialized befur usage. Therefore subsequent runs of the tool will create identical 4 | loss pattern. 5 | 6 | usage: 7 | 8 | rtp_loss.exe infile outfile losspercent 9 | 10 | 11 | is an optinal parameter that specifies the number of RTP 12 | packets that are kept at the beginning of the file. This can be useful if the loss 13 | of parameter sets or IDR pictures shall be avoided. 14 | -------------------------------------------------------------------------------- /ldecod/inc/context_ini.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************* 4 | * \file context_ini.h 5 | * 6 | * \brief 7 | * CABAC context initializations 8 | * 9 | * \author 10 | * Main contributors (see contributors.h for copyright, address and affiliation details) 11 | * - Detlev Marpe 12 | * - Heiko Schwarz 13 | ************************************************************************************** 14 | */ 15 | 16 | 17 | #ifndef _CONTEXT_INI_ 18 | #define _CONTEXT_INI_ 19 | 20 | extern void init_contexts (Slice *currslice); 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /ldecod/inc/errorconcealment.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /*! 4 | **************************************************************************** 5 | * \file errorconcealment.h 6 | * 7 | * \brief 8 | * Header file for errorconcealment.c 9 | * 10 | **************************************************************************** 11 | */ 12 | 13 | #ifndef _ERRORCONCEALMENT_H_ 14 | #define _ERRORCONCEALMENT_H_ 15 | 16 | extern int get_concealed_element(VideoParameters *p_Vid, SyntaxElement *sym); 17 | extern int set_ec_flag (VideoParameters *p_Vid, int se); 18 | extern void reset_ec_flags (VideoParameters *p_Vid); 19 | 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /unixprep.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | which sed || (echo "sed unavailable" 1>&2; exit 1) 4 | 5 | echo "Removing DOS LF chars..." 6 | for f in l[ed][ne]cod/[si][rn]c/*.[ch] bin/*.cfg 7 | do 8 | sed -e "s/ //" < $f >$f.tmp && mv $f.tmp $f 9 | done 10 | 11 | for f in l[ed][ne]cod/Makefile 12 | do 13 | sed -e "s/ //" < $f >$f.tmp && mv $f.tmp $f 14 | done 15 | 16 | for f in rtpdump/*.cpp rtpdump/Makefile 17 | do 18 | sed -e "s/ //" < $f >$f.tmp && mv $f.tmp $f 19 | done 20 | 21 | for f in rtp_loss/*.cpp rtp_loss/*.h rtp_loss/Makefile 22 | do 23 | sed -e "s/ //" < $f >$f.tmp && mv $f.tmp $f 24 | done 25 | 26 | 27 | echo "Done." 28 | 29 | -------------------------------------------------------------------------------- /lencod/inc/img_dist_snr.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * img_dist_snr.h 5 | * 6 | * \author 7 | * Woo-Shik Kim 8 | * 9 | * \date 10 | * 29 May 2008 11 | * 12 | * \brief 13 | * Headerfile to calculate signal to noise ratio (SNR) 14 | ************************************************************************** 15 | */ 16 | 17 | #ifndef _IMG_DIST_SNR_H_ 18 | #define _IMG_DIST_SNR_H_ 19 | #include "img_distortion.h" 20 | 21 | extern void find_snr(VideoParameters *p_Vid, ImageStructure *imgREF, ImageStructure *imgSRC, DistMetric metricSSE[3], DistMetric metricPSNR[3]); 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /lcommon/inc/mv_prediction.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************************* 3 | * \file mv_prediction.h 4 | * 5 | * \brief 6 | * Declarations for Motion Vector Prediction 7 | * 8 | * \author 9 | * Main contributors (see contributors.h for copyright, address and affiliation details) 10 | * - Alexis Michael Tourapis 11 | ************************************************************************************* 12 | */ 13 | 14 | #ifndef _MV_PREDICTION_H_ 15 | #define _MV_PREDICTION_H_ 16 | 17 | extern void init_motion_vector_prediction(Macroblock *currMB, int mb_aff_frame_flag); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /lencod/inc/img_chroma.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * img_chroma.h 5 | * 6 | * \author 7 | * Athanasios Leontaris 8 | * Alexis Michael Tourapis 9 | * 10 | * \date 11 | * 4. October 2006 12 | * 13 | * \brief 14 | * Headerfile for luma interpolation functions 15 | ************************************************************************** 16 | */ 17 | 18 | #ifndef _IMG_CHROMA_H_ 19 | #define _IMG_CHROMA_H_ 20 | 21 | extern void getSubImagesChroma( VideoParameters *p_Vid, StorablePicture *s ); 22 | 23 | #endif // _IMG_CHROMA_H_ 24 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/BQMall.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/BQMall_832x480_60.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 60 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 832 # Input frame width 8 | SourceHeight = 480 # Input frame height 9 | FramesToBeEncoded = 600 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/BQSquare.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/BQSquare_416x240_60.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 60 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 416 # Input frame width 8 | SourceHeight = 240 # Input frame height 9 | FramesToBeEncoded = 600 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/Cactus.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/Cactus_1920x1080_50.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 50 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 1920 # Input frame width 8 | SourceHeight = 1080 # Input frame height 9 | FramesToBeEncoded = 500 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/Kimono.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/Kimono1_1920x1080_24.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 24 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 1920 # Input frame width 8 | SourceHeight = 1080 # Input frame height 9 | FramesToBeEncoded = 240 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/Vidyo1.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/vidyo1_1280x720_60.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 60 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 1280 # Input frame width 8 | SourceHeight = 720 # Input frame height 9 | FramesToBeEncoded = 600 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/Vidyo3.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/vidyo3_1280x720_60.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 60 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 1280 # Input frame width 8 | SourceHeight = 720 # Input frame height 9 | FramesToBeEncoded = 600 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/Vidyo4.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/vidyo4_1280x720_60.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 60 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 1280 # Input frame width 8 | SourceHeight = 720 # Input frame height 9 | FramesToBeEncoded = 600 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /lcommon/inc/lagrangian.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************** 3 | * \file lagrangian.h 4 | * \brief 5 | * Distortion data header file 6 | * \date 2.23.2009, 7 | * 8 | * \author 9 | * Alexis Michael Tourapis 10 | * 11 | ************************************************************************** 12 | */ 13 | 14 | #ifndef _LAGRANGIAN_H_ 15 | #define _LAGRANGIAN_H_ 16 | 17 | typedef struct lambda_params 18 | { 19 | double md; //!< Mode decision Lambda 20 | double me[3]; //!< Motion Estimation Lambda 21 | int mf[3]; //!< Integer formatted Motion Estimation Lambda 22 | } LambdaParams; 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /ldecod/inc/header.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************************* 3 | * \file header.h 4 | * 5 | * \brief 6 | * Prototypes for header.c 7 | ************************************************************************************* 8 | */ 9 | 10 | #ifndef _HEADER_H_ 11 | #define _HEADER_H_ 12 | 13 | extern int FirstPartOfSliceHeader(Slice *currSlice); 14 | extern int RestOfSliceHeader (Slice *currSlice); 15 | 16 | extern void dec_ref_pic_marking(VideoParameters *p_Vid, Bitstream *currStream, Slice *pSlice); 17 | 18 | extern void decode_poc(VideoParameters *p_Vid, Slice *pSlice); 19 | extern int dumppoc (VideoParameters *p_Vid); 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/BQTerrace.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/BQTerrace_1920x1080_60.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 60 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 1920 # Input frame width 8 | SourceHeight = 1080 # Input frame height 9 | FramesToBeEncoded = 600 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/ChinaSpeed.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/ChinaSpeed_1024x768_30.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 30 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 1024 # Input frame width 8 | SourceHeight = 768 # Input frame height 9 | FramesToBeEncoded = 500 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/ParkScene.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/ParkScene_1920x1080_24.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 24 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 1920 # Input frame width 8 | SourceHeight = 1080 # Input frame height 9 | FramesToBeEncoded = 240 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/PartyScene.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/PartyScene_832x480_50.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 50 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 832 # Input frame width 8 | SourceHeight = 480 # Input frame height 9 | FramesToBeEncoded = 500 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/RaceHorsesC.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/RaceHorses_832x480_30.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 30 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 832 # Input frame width 8 | SourceHeight = 480 # Input frame height 9 | FramesToBeEncoded = 300 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/SlideShow.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/SlideShow_1280x720_20.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 20 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 1280 # Input frame width 8 | SourceHeight = 720 # Input frame height 9 | FramesToBeEncoded = 500 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/Traffic.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/Traffic_2560x1600_30_crop.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 30 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 2560 # Input frame width 8 | SourceHeight = 1600 # Input frame height 9 | FramesToBeEncoded = 150 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/RaceHorses.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../../origCfP/RaceHorses_416x240_30.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 30 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 416 # Input frame width 8 | SourceHeight = 240 # Input frame height 9 | FramesToBeEncoded = 300 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/SlideEditing.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/SlideEditing_1280x720_30.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 30 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 1280 # Input frame width 8 | SourceHeight = 720 # Input frame height 9 | FramesToBeEncoded = 300 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/BasketballDrill.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/BasketballDrill_832x480_50.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 50 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 832 # Input frame width 8 | SourceHeight = 480 # Input frame height 9 | FramesToBeEncoded = 500 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/BasketballDrive.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/BasketballDrive_1920x1080_50.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 50 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 1920 # Input frame width 8 | SourceHeight = 1080 # Input frame height 9 | FramesToBeEncoded = 500 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/BasketballPass.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/BasketballPass_416x240_50.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 50 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 416 # Input frame width 8 | SourceHeight = 240 # Input frame height 9 | FramesToBeEncoded = 500 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/BlowingBubbles.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/BlowingBubbles_416x240_50.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 50 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 416 # Input frame width 8 | SourceHeight = 240 # Input frame height 9 | FramesToBeEncoded = 500 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/PeopleOnStreet.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/PeopleOnStreet_2560x1600_30_crop.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 30 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 2560 # Input frame width 8 | SourceHeight = 1600 # Input frame height 9 | FramesToBeEncoded = 150 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/BasketballDrillText.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/BasketballDrillText_832x480_50.yuv" 3 | SourceBitDepthLuma = 8 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 8 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 50 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 832 # Input frame width 8 | SourceHeight = 480 # Input frame height 9 | FramesToBeEncoded = 500 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /ldecod/inc/transform8x8.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * 4 | * \file transform8x8.h 5 | * 6 | * \brief 7 | * prototypes of 8x8 transform functions 8 | * 9 | * \date 10 | * 9. October 2003 11 | * 12 | * \author 13 | * Main contributors (see contributors.h for copyright, address and affiliation details) 14 | * - Yuri Vatis 15 | **************************************************************************/ 16 | 17 | #ifndef _TRANSFORM8X8_H_ 18 | #define _TRANSFORM8X8_H_ 19 | 20 | extern void itrans8x8 (Macroblock *currMB, ColorPlane pl, int ioff, int joff); 21 | extern void icopy8x8 (Macroblock *currMB, ColorPlane pl, int ioff, int joff); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /lencod/inc/header.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************* 4 | * \file header.h 5 | * 6 | * \brief 7 | * Prototypes for header.c 8 | ************************************************************************************* 9 | */ 10 | 11 | #ifndef _HEADER_H_ 12 | #define _HEADER_H_ 13 | 14 | extern int SliceHeader (Slice* currSlice); 15 | extern int Partition_BC_Header(Slice *currSlice, int PartNo); 16 | extern int writeERPS (SyntaxElement *sym, DataPartition *partition); 17 | extern int dec_ref_pic_marking(Bitstream *bitstream, DecRefPicMarking_t *p_drpm, int idr_flag, int no_output_of_prior_pics_flag, int long_term_reference_flag ); 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /lencod/inc/macroblock_p444.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file 5 | * macroblock_p444.h 6 | * 7 | * \brief 8 | * Arrays for macroblock processing (P444 mode) 9 | * 10 | * \author 11 | * 12 | ************************************************************************/ 13 | 14 | #ifndef _MACROBLOCK_P444_H_ 15 | #define _MACROBLOCK_P444_H_ 16 | 17 | #include "block.h" 18 | 19 | extern int luma_residual_coding_p444_16x16 (Macroblock* currMB, int, short, int[2], char *); 20 | extern int luma_residual_coding_p444_8x8 (Macroblock* currMB, int*, int64*, int, short, int[2], char *); 21 | extern void luma_residual_coding_p444 (Macroblock *currMB); 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/NebutaFestival_10bit.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/NebutaFestival_2560x1600_60_10bit_crop.yuv" 3 | SourceBitDepthLuma = 10 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 10 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 60 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 2560 # Input frame width 8 | SourceHeight = 1600 # Input frame height 9 | FramesToBeEncoded = 300 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /bin/HM-like/per-sequence_JM/SteamLocomotiveTrain_10bit.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile = "../../origCfP/SteamLocomotiveTrain_2560x1600_60_10bit_crop.yuv" 3 | SourceBitDepthLuma = 10 # Source Bit Depth for Luma color component (8...14 bits) 4 | SourceBitDepthChroma = 10 # Source Bit Depth for Chroma color components (8...14 bits) 5 | FrameRate = 60 # Frame Rate per second 6 | FrameSkip = 0 # Number of frames to be skipped in input 7 | SourceWidth = 2560 # Input frame width 8 | SourceHeight = 1600 # Input frame height 9 | FramesToBeEncoded = 300 # Number of frames to be coded 10 | -------------------------------------------------------------------------------- /ldecod/inc/leaky_bucket.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************* 4 | * \file leaky_bucket.h 5 | * 6 | * \brief 7 | * Header for Leaky Buffer parameters 8 | * 9 | * \author 10 | * Main contributors (see contributors.h for copyright, address and affiliation details) 11 | * - Shankar Regunathan 12 | ************************************************************************************* 13 | */ 14 | #ifndef _LEAKY_BUCKET_H_ 15 | #define _LEAKY_BUCKET_H_ 16 | 17 | #include "global.h" 18 | 19 | #ifdef _LEAKYBUCKET_ 20 | // Leaky Bucket functions 21 | unsigned long GetBigDoubleWord(FILE *fp); 22 | void calc_buffer(InputParameters *p_Inp); 23 | #endif 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /lcommon/inc/io_raw.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file io_raw.h 5 | * 6 | * \brief 7 | * I/O functions related to raw images 8 | * 9 | * \author 10 | * - Alexis Michael Tourapis 11 | * 12 | ************************************************************************ 13 | */ 14 | 15 | #ifndef _IO_RAW_H_ 16 | #define _IO_RAW_H_ 17 | 18 | extern int ReadFrameConcatenated (InputParameters *p_Inp, VideoDataFile *input_file, int FrameNoInFile, int HeaderSize, FrameFormat *source, unsigned char *buf); 19 | extern int ReadFrameSeparate (InputParameters *p_Inp, VideoDataFile *input_file, int FrameNoInFile, int HeaderSize, FrameFormat *source, unsigned char *buf); 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /lencod/inc/wp_random.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * wp_random.h 5 | * 6 | * \author 7 | * Alexis Michael Tourapis 8 | * 9 | * \date 10 | * 19. December 2011 11 | * 12 | * \brief 13 | * Headerfile for weighted prediction using a random number generator 14 | ************************************************************************** 15 | */ 16 | 17 | #ifndef _WP_RANDOM_H_ 18 | #define _WP_RANDOM_H_ 19 | 20 | extern void EstimateWPPSliceRandom(Slice *currSlice, int offset); 21 | extern void EstimateWPBSliceRandom(Slice *currSlice); 22 | extern int TestWPPSliceRandom (Slice *currSlice, int offset); 23 | extern int TestWPBSliceRandom (Slice *currSlice, int method); 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /lencod/inc/wp_periodic.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * wp_periodic.h 5 | * 6 | * \author 7 | * Alexis Michael Tourapis 8 | * 9 | * \date 10 | * 19. December 2011 11 | * 12 | * \brief 13 | * Headerfile for weighted prediction using a random number generator 14 | ************************************************************************** 15 | */ 16 | 17 | #ifndef _WP_PERIODIC_H_ 18 | #define _WP_PERIODIC_H_ 19 | 20 | extern void EstimateWPPSlicePeriodic(Slice *currSlice, int offset); 21 | extern void EstimateWPBSlicePeriodic(Slice *currSlice); 22 | extern int TestWPPSlicePeriodic (Slice *currSlice, int offset); 23 | extern int TestWPBSlicePeriodic (Slice *currSlice, int method); 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /lcommon/inc/img_process_types.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************ 3 | * \file img_process_types.h 4 | * 5 | * \brief 6 | * Input data Image Processing Types 7 | * 8 | * \author 9 | * Main contributors (see contributors.h for copyright, address and affiliation details) 10 | * - Alexis Michael Tourapis 11 | * - Athanasios Leontaris 12 | * - Yuwen He 13 | ************************************************************************ 14 | */ 15 | 16 | #ifndef _IMG_PROCESS_TYPES_H_ 17 | #define _IMG_PROCESS_TYPES_H_ 18 | 19 | #define DEMUX_META_DEBUG 1 20 | #define MAX_NUM_PARTITIONS 512 21 | #define NUM_VIEWS 2 22 | #define NUM_COMPONENTS 3 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /lcommon/inc/io_tiff.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************ 3 | * \file io_tiff.h 4 | * 5 | * \brief 6 | * I/O functions related to tiff images 7 | * Part of code was based on libtiff (see http://www.libtiff.org/) 8 | * 9 | * \author 10 | * - Larry Luther 11 | * - Alexis Michael Tourapis 12 | * 13 | ************************************************************************ 14 | */ 15 | 16 | #ifndef _IO_TIFF_H_ 17 | #define _IO_TIFF_H_ 18 | // See TIFF 6.0 Specification 19 | // http://partners.adobe.com/public/developer/tiff/index.html 20 | 21 | 22 | extern int ReadTIFFImage (InputParameters *p_Inp, VideoDataFile *input_file, int FrameNoInFile, FrameFormat *source, unsigned char *buf); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /lencod/inc/wp_mciter.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * wp_mciter.h 5 | * 6 | * \author 7 | * Alexis Michael Tourapis 8 | * 9 | * \date 10 | * 22. February 2008 11 | * 12 | * \brief 13 | * Headerfile for weighted prediction support 14 | ************************************************************************** 15 | */ 16 | 17 | #ifndef _WP_MCITERM_H_ 18 | #define _WP_MCITERM_H_ 19 | 20 | 21 | extern void EstimateWPBSliceAlg2(Slice *currSlice); 22 | extern void EstimateWPPSliceAlg2(Slice *currSlice, int offset); 23 | extern int TestWPPSliceAlg2 (Slice *currSlice, int offset); 24 | extern int TestWPBSliceAlg2 (Slice *currSlice, int method); 25 | 26 | extern void compute_offset (Slice *currSlice); 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /lencod/inc/annexb.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************************** 3 | * \file 4 | * annexb.h 5 | * \brief 6 | * Byte stream operations support 7 | * 8 | * \date 7 December 2002 9 | * \author 10 | * Main contributors (see contributors.h for copyright, address and affiliation details) 11 | * - Stephan Wenger 12 | *************************************************************************************** 13 | */ 14 | 15 | #ifndef _ANNEXB_H_ 16 | #define _ANNEXB_H_ 17 | 18 | #include "nalucommon.h" 19 | 20 | extern int WriteAnnexbNALU (VideoParameters *p_Vid, NALU_t *n, FILE **f_annexb); 21 | extern void OpenAnnexbFile (char *fn, FILE **f_annexb); 22 | extern void CloseAnnexbFile(FILE *f_annexb); 23 | 24 | 25 | #endif //_ANNEXB_H_ 26 | -------------------------------------------------------------------------------- /lencod/inc/cconv_yuv2rgb.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * cconv_yuv2rgb.h 5 | * 6 | * \author 7 | * Woo-Shik Kim 8 | * 9 | * \date 10 | * 29 May 2008 11 | * 12 | * \brief 13 | * Headerfile for YUV to RGB color conversion 14 | ************************************************************************** 15 | */ 16 | 17 | #ifndef _CCONV_YUV2RGB_H_ 18 | #define _CCONV_YUV2RGB_H_ 19 | 20 | #include "img_distortion.h" 21 | 22 | extern void init_YUVtoRGB (VideoParameters *p_Vid, InputParameters *p_Inp); 23 | extern void YUVtoRGB (VideoParameters *p_Vid, ImageStructure *YUV, ImageStructure *RGB); 24 | extern int create_RGB_memory(VideoParameters *p_Vid); 25 | extern void delete_RGB_memory(VideoParameters *p_Vid); 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /lencod/inc/q_offsets.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | *************************************************************************** 4 | * \file 5 | * q_offsets.h 6 | * 7 | * \brief 8 | * Headerfile for q_offsets array 9 | * 10 | * \date 11 | * 18. Nov 2004 12 | *************************************************************************** 13 | */ 14 | 15 | #ifndef _Q_OFFSETS_H_ 16 | #define _Q_OFFSETS_H_ 17 | 18 | static const int OffsetBits = 11; 19 | 20 | extern void init_qoffset (VideoParameters *p_Vid); 21 | extern void CalculateOffset4x4Param (VideoParameters *p_Vid); 22 | extern void CalculateOffset8x8Param (VideoParameters *p_Vid); 23 | extern void free_QOffsets (QuantParameters *p_Quant, InputParameters *p_Inp); 24 | extern void InitOffsetParam (QuantParameters *p_Quant, InputParameters *p_Inp); 25 | #endif 26 | -------------------------------------------------------------------------------- /lcommon/inc/img_process.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************ 3 | * \file img_process.h 4 | * 5 | * \brief 6 | * Input data Image Processing functions 7 | * 8 | * \author 9 | * Main contributors (see contributors.h for copyright, address and affiliation details) 10 | * - Alexis Michael Tourapis 11 | * 12 | ************************************************************************ 13 | */ 14 | 15 | #ifndef _IMG_PROCESS_H_ 16 | #define _IMG_PROCESS_H_ 17 | 18 | 19 | extern int init_process_image ( VideoParameters *p_Vid, InputParameters *p_Inp ); 20 | extern void clear_process_image( VideoParameters *p_Vid, InputParameters *p_Inp); 21 | extern void process_image ( VideoParameters *p_Vid, InputParameters *p_Inp ); 22 | 23 | 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /ldecod/inc/nalu.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************** 4 | * \file 5 | * nalu.h 6 | * \brief 7 | * Common NALU support functions 8 | * 9 | * \date 25 November 2002 10 | * \author 11 | * Main contributors (see contributors.h for copyright, address and affiliation details) 12 | * - Stephan Wenger 13 | *************************************************************************************** 14 | */ 15 | 16 | 17 | #ifndef _NALU_H_ 18 | #define _NALU_H_ 19 | 20 | #include "nalucommon.h" 21 | 22 | extern void CheckZeroByteNonVCL(VideoParameters *p_Vid, NALU_t *nalu); 23 | extern void CheckZeroByteVCL (VideoParameters *p_Vid, NALU_t *nalu); 24 | 25 | extern int read_next_nalu(VideoParameters *p_Vid, NALU_t *nalu); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /lencod/inc/filehandle.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | *************************************************************************** 4 | * 5 | * \file filehandle.h 6 | * 7 | * \brief 8 | * 9 | * \date 10 | * 11 | * \author 12 | * Main contributors (see contributors.h for copyright, address and affiliation details) 13 | * 14 | **************************************************************************/ 15 | 16 | #ifndef _FILEHANDLE_H_ 17 | #define _FILEHANDLE_H_ 18 | 19 | extern int rewrite_paramsets (VideoParameters *p_Vid); 20 | extern int start_sequence (VideoParameters *p_Vid, InputParameters *p_Inp); 21 | extern int terminate_sequence(VideoParameters *p_Vid, InputParameters *p_Inp); 22 | extern int write_PPS (VideoParameters *p_Vid, int len, int PPS_id); 23 | extern int end_of_stream (VideoParameters *p_Vid); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /lcommon/inc/report.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file report.h 5 | * 6 | * \brief 7 | * headers for frame format related information 8 | * 9 | * \author 10 | * 11 | ************************************************************************ 12 | */ 13 | #ifndef _REPORT_H_ 14 | #define _REPORT_H_ 15 | #include "contributors.h" 16 | #include "global.h" 17 | #include "enc_statistics.h" 18 | 19 | extern void report ( VideoParameters *p_Vid, InputParameters *p_Inp, StatParameters *p_Stats ); 20 | extern void information_init ( VideoParameters *p_Vid, InputParameters *p_Inp, StatParameters *p_Stats ); 21 | extern void report_frame_statistic( VideoParameters *p_Vid, InputParameters *p_Inp ); 22 | extern void report_stats_on_error (void); 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /lencod/inc/explicit_gop.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************* 4 | * \file explicit_gop.h 5 | * 6 | * \brief 7 | * Functions for explicit gop and hierarchy support 8 | * 9 | * \author 10 | * Main contributors (see contributors.h for copyright, address and affiliation details) 11 | * - Alexis Michael Tourapis 12 | ************************************************************************************* 13 | */ 14 | 15 | #ifndef _EXPLICIT_GOP_H_ 16 | #define _EXPLICIT_GOP_H_ 17 | 18 | // GOP Hierarchy 19 | extern void init_gop_structure (VideoParameters *p_Vid, InputParameters *p_Inp); 20 | extern void interpret_gop_structure(VideoParameters *p_Vid, InputParameters *p_Inp); 21 | extern void clear_gop_structure (VideoParameters *p_Vid); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /ldecod/inc/intra8x8_pred.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************************* 3 | * \file intra8x8_pred.h 4 | * 5 | * \brief 6 | * definitions for intra 8x8 prediction 7 | * 8 | * \author 9 | * Main contributors (see contributors.h for copyright, 10 | * address and affiliation details) 11 | * - Alexis Michael Tourapis 12 | * 13 | ************************************************************************************* 14 | */ 15 | 16 | #ifndef _INTRA8x8_PRED_H_ 17 | #define _INTRA8x8_PRED_H_ 18 | 19 | #include "global.h" 20 | #include "mbuffer.h" 21 | 22 | extern int intra_pred_8x8_normal(Macroblock *currMB, ColorPlane pl, int ioff, int joff); 23 | extern int intra_pred_8x8_mbaff(Macroblock *currMB, ColorPlane pl, int ioff, int joff); 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /ldecod/inc/intra16x16_pred.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************************* 3 | * \file intra16x16_pred.h 4 | * 5 | * \brief 6 | * definitions for intra 16x16 prediction 7 | * 8 | * \author 9 | * Main contributors (see contributors.h for copyright, 10 | * address and affiliation details) 11 | * - Alexis Michael Tourapis 12 | * 13 | ************************************************************************************* 14 | */ 15 | 16 | #ifndef _INTRA16x16_PRED_H_ 17 | #define _INTRA16x16_PRED_H_ 18 | 19 | #include "global.h" 20 | #include "mbuffer.h" 21 | 22 | extern int intra_pred_16x16_mbaff (Macroblock *currMB, ColorPlane pl, int predmode); 23 | extern int intra_pred_16x16_normal(Macroblock *currMB, ColorPlane pl, int predmode); 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /lencod/inc/rd_intra_jm444.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * rd_intra_jm444.h 5 | * 6 | * \author 7 | * Alexis Michael Tourapis 8 | * 9 | * \date 10 | * 2 January 2008 11 | * 12 | * \brief 13 | * Headerfile for JM rd based intra mode decision (High444) 14 | ************************************************************************** 15 | */ 16 | 17 | #ifndef _RD_INTRA_JM444_H_ 18 | #define _RD_INTRA_JM444_H_ 19 | 20 | extern int mode_decision_for_I16x16_MB_444 (Macroblock *currMB, int lambda); 21 | extern int mode_decision_for_I4x4_blocks_JM_High444 (Macroblock *currMB, int b8, int b4, int lambda, distblk* min_cost); 22 | extern int mode_decision_for_I4x4_blocks_JM_Low444 (Macroblock *currMB, int b8, int b4, int lambda, distblk* min_cost); 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /lencod/inc/intrarefresh.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | *************************************************************************** 4 | * 5 | * \file intrarefresh.h 6 | * 7 | * \brief 8 | * Pseudo-Raqndom Intra macroblock refresh support 9 | * 10 | * \date 11 | * 16 June 2002 12 | * 13 | * \author 14 | * Stephan Wenger stewe@cs.tu-berlin.de 15 | **************************************************************************/ 16 | 17 | #ifndef _INTRAREFRESH_H_ 18 | #define _INTRAREFRESH_H_ 19 | 20 | extern void RandomIntraInit(VideoParameters *p_Vid, int xsize, int ysize, int refresh); 21 | extern void RandomIntraUninit(VideoParameters *p_Vid); 22 | extern int RandomIntra (VideoParameters *p_Vid, int mb); //! returns 1 for MBs that need forced Intra 23 | extern void RandomIntraNewPicture (VideoParameters *p_Vid); //! to be called once per picture 24 | 25 | 26 | #endif //_INTRAREFRESH_H_ 27 | -------------------------------------------------------------------------------- /lencod/inc/img_dist_ssim.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * img_dist_ssim.h 5 | * 6 | * \author 7 | * Main contributors (see contributors.h for copyright, address and affiliation details) 8 | * - Woo-Shik Kim 9 | * - Alexis Michael Tourapis 10 | * 11 | * \date 12 | * 29 May 2008 13 | * 14 | * \brief 15 | * Headerfile to calculate structural similarity (SSIM) index 16 | ************************************************************************** 17 | */ 18 | 19 | #ifndef _IMG_DIST_SSIM_H_ 20 | #define _IMG_DIST_SSIM_H_ 21 | #include "img_distortion.h" 22 | 23 | extern void find_ssim (VideoParameters *p_Vid, InputParameters *p_Inp, ImageStructure *imgREF, ImageStructure *imgSRC, DistMetric metricSSIM[3]); 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /lcommon/inc/fast_memory.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************** 3 | * \file fast_memory.h 4 | * 5 | * \brief 6 | * Memory handling operations 7 | * 8 | * \author 9 | * Main contributors (see contributors.h for copyright, address and affiliation details) 10 | * - Chris Vogt 11 | * 12 | ************************************************************************** 13 | */ 14 | 15 | #ifndef _FAST_MEMORY_H_ 16 | #define _FAST_MEMORY_H_ 17 | 18 | #include "typedefs.h" 19 | 20 | 21 | static inline void fast_memset(void *dst,int value,int width) 22 | { 23 | memset(dst,value,width); 24 | } 25 | 26 | static inline void fast_memcpy(void *dst,void *src,int width) 27 | { 28 | memcpy(dst,src,width); 29 | } 30 | 31 | static inline void fast_memset_zero(void *dst, int width) 32 | { 33 | memset(dst,0,width); 34 | } 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /lencod/inc/nalu.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************** 4 | * \file 5 | * nalu.h 6 | * \brief 7 | * Common NALU support functions 8 | * 9 | * \date 25 November 2002 10 | * \author 11 | * Main contributors (see contributors.h for copyright, address and affiliation details) 12 | * - Stephan Wenger 13 | *************************************************************************************** 14 | */ 15 | 16 | 17 | #ifndef _NALU_H_ 18 | #define _NALU_H_ 19 | 20 | #include "nalucommon.h" 21 | 22 | extern int RBSPtoNALU (unsigned char *rbsp, NALU_t *nalu, int rbsp_size, int nal_unit_type, int nal_reference_idc, int UseAnnexbLongStartcode); 23 | extern int Write_AUD_NALU( VideoParameters *p_Vid ); 24 | extern int Write_Filler_Data_NALU( VideoParameters *p_Vid, int num_bytes ); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /lencod/inc/nal.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************** 4 | * \file 5 | * nal.h 6 | * \brief 7 | * NAL related headers 8 | * 9 | * \date 4 Agust 2008 10 | * \author 11 | * Main contributors (see contributors.h for copyright, address and affiliation details) 12 | * - Karsten Suehring 13 | * - Alexis Michael Tourapis 14 | *************************************************************************************** 15 | */ 16 | 17 | 18 | #ifndef _NAL_H_ 19 | #define _NAL_H_ 20 | 21 | #include "nalucommon.h" 22 | #include "enc_statistics.h" 23 | 24 | extern int addCabacZeroWords(VideoParameters *p_Vid, NALU_t *nalu, StatParameters *cur_stats); 25 | extern void SODBtoRBSP (Bitstream *currStream); 26 | extern int RBSPtoEBSP(byte *NaluBuffer, unsigned char *rbsp, int rbsp_size); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /lencod/inc/img_dist_ms_ssim.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * img_dist_ms_ssim.h 5 | * 6 | * \author 7 | * Main contributors (see contributors.h for copyright, address and affiliation details) 8 | * - Woo-Shik Kim 9 | * - Alexis Michael Tourapis 10 | * 11 | * \date 12 | * 18 July 2008 13 | * 14 | * \brief 15 | * Headerfile to calculate multi-scale structural similarity (SSIM) index 16 | ************************************************************************** 17 | */ 18 | 19 | #ifndef _IMG_DIST_MS_SSIM_H_ 20 | #define _IMG_DIST_MS_SSIM_H_ 21 | #include "img_distortion.h" 22 | 23 | extern void find_ms_ssim (VideoParameters *p_Vid, InputParameters *p_Inp, ImageStructure *imgREF, ImageStructure *imgSRC, DistMetric metricMS_SSIM[3]); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /lcommon/inc/distortion.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************** 3 | * \file distortion.h 4 | * \brief 5 | * Distortion data header file 6 | * \date 2.23.2009, 7 | * 8 | * \author 9 | * Alexis Michael Tourapis 10 | * 11 | ************************************************************************** 12 | */ 13 | 14 | #ifndef _DISTORTION_H_ 15 | #define _DISTORTION_H_ 16 | 17 | // Distortion data structure. Could be extended in the future to support 18 | // other data 19 | typedef struct distortion_data 20 | { 21 | int i4x4rd[4][4]; //! i4x4 rd cost 22 | distblk i4x4 [4][4]; //! i4x4 cost 23 | distblk i8x8 [2][2]; //! i8x8 cost 24 | int i8x8rd[2][2]; //! i8x8 rd cost 25 | int i16x16; 26 | int i16x16rd; 27 | double rd_cost; 28 | } DistortionData; 29 | 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /ldecod/inc/filehandle.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************** 4 | * \file 5 | * filehandle.h 6 | * \brief 7 | * Trace file handling and standard error handling function headers. 8 | * \author 9 | * Main contributors (see contributors.h for copyright, address and affiliation details) 10 | * - Karsten Suehring 11 | * - Alexis Michael Tourapis 12 | *************************************************************************************** 13 | */ 14 | 15 | #include "contributors.h" 16 | 17 | #if TRACE 18 | extern void dectracebitcnt(int count); 19 | extern void tracebits ( const char *trace_str, int len, int info, int value1); 20 | extern void tracebits2 ( const char *trace_str, int len, int info); 21 | extern void trace_info ( SyntaxElement *currSE, const char *description_str, int value1 ); 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /ldecod/inc/intra4x4_pred.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************************* 3 | * \file intra4x4_pred.h 4 | * 5 | * \brief 6 | * definitions for intra 4x4 prediction 7 | * 8 | * \author 9 | * Main contributors (see contributors.h for copyright, 10 | * address and affiliation details) 11 | * - Alexis Michael Tourapis 12 | * 13 | ************************************************************************************* 14 | */ 15 | 16 | #ifndef _INTRA4x4_PRED_H_ 17 | #define _INTRA4x4_PRED_H_ 18 | 19 | #include "global.h" 20 | #include "mbuffer.h" 21 | 22 | extern int intra_pred_4x4_mbaff (Macroblock *currMB, ColorPlane pl, int ioff, int joff, int img_block_x, int img_block_y); 23 | extern int intra_pred_4x4_normal(Macroblock *currMB, ColorPlane pl, int ioff, int joff, int img_block_x, int img_block_y); 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /lcommon/inc/blk_prediction.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file 5 | * blk_prediction.h 6 | * 7 | * \brief 8 | * block prediction header 9 | * 10 | * \author 11 | * Main contributors (see contributors.h for copyright, 12 | * address and affiliation details) 13 | * - Alexis Michael Tourapis 14 | * 15 | ************************************************************************************* 16 | */ 17 | 18 | #ifndef _BLK_PREDICTION_H_ 19 | #define _BLK_PREDICTION_H_ 20 | #include "mbuffer.h" 21 | 22 | extern void compute_residue (imgpel **curImg, imgpel **mb_pred, int **mb_rres, int mb_x, int opix_x, int width, int height); 23 | extern void sample_reconstruct (imgpel **curImg, imgpel **mb_pred, int **mb_rres, int mb_x, int opix_x, int width, int height, int max_imgpel_value, int dq_bits); 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /ldecod/inc/fmo.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | *************************************************************************** 4 | * 5 | * \file fmo.h 6 | * 7 | * \brief 8 | * Support for Flexilble Macroblock Ordering (FMO) 9 | * 10 | * \date 11 | * 19 June, 2002 12 | * 13 | * \author 14 | * Stephan Wenger stewe@cs.tu-berlin.de 15 | **************************************************************************/ 16 | 17 | #ifndef _FMO_H_ 18 | #define _FMO_H_ 19 | 20 | 21 | extern int fmo_init (VideoParameters *p_Vid, Slice *pSlice); 22 | extern int FmoFinit (VideoParameters *p_Vid); 23 | 24 | extern int FmoGetNumberOfSliceGroup(VideoParameters *p_Vid); 25 | extern int FmoGetLastMBOfPicture (VideoParameters *p_Vid); 26 | extern int FmoGetLastMBInSliceGroup(VideoParameters *p_Vid, int SliceGroup); 27 | extern int FmoGetSliceGroupId (VideoParameters *p_Vid, int mb); 28 | extern int FmoGetNextMBNr (VideoParameters *p_Vid, int CurrentMbNr); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /lencod/inc/q_matrix.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | *************************************************************************** 4 | * \file 5 | * q_matrix.h 6 | * 7 | * \brief 8 | * Headerfile for q_matrix array 9 | * 10 | * \date 11 | * 07. Apr 2004 12 | *************************************************************************** 13 | */ 14 | 15 | #ifndef _Q_MATRIX_H_ 16 | #define _Q_MATRIX_H_ 17 | 18 | struct scaling_list { 19 | short ScalingList4x4input[6][16]; 20 | short ScalingList8x8input[6][64]; 21 | short ScalingList4x4[6][16]; 22 | short ScalingList8x8[6][64]; 23 | 24 | short UseDefaultScalingMatrix4x4Flag[6]; 25 | short UseDefaultScalingMatrix8x8Flag[6]; 26 | }; 27 | 28 | extern void init_qmatrix (VideoParameters *p_Vid, InputParameters *p_Inp); 29 | extern void CalculateQuant4x4Param (VideoParameters *p_Vid); 30 | extern void CalculateQuant8x8Param (VideoParameters *p_Vid); 31 | extern void free_QMatrix(QuantParameters *p_Quant); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /lencod/inc/me_epzs_int.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file 5 | * me_epzs_int.h 6 | * 7 | * \author 8 | * Alexis Michael Tourapis 9 | * 10 | * \date 11 | * 11. August 2006 12 | * 13 | * \brief 14 | * Headerfile for EPZS motion estimation 15 | ************************************************************************** 16 | */ 17 | 18 | 19 | #ifndef _ME_EPZS_INT_H_ 20 | #define _ME_EPZS_INT_H_ 21 | 22 | #include "me_epzs.h" 23 | 24 | // Functions 25 | extern distblk EPZS_integer_motion_estimation (Macroblock *, MotionVector *, MEBlock *, distblk, int); 26 | extern distblk EPZS_integer_subMB_motion_estimation (Macroblock *, MotionVector *, MEBlock *, distblk, int); 27 | extern distblk EPZS_integer_bipred_motion_estimation (Macroblock *, int, MotionVector *, MotionVector *, MotionVector *, MotionVector *, MEBlock *, int, distblk, int); 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /lcommon/inc/input.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************ 3 | * \file input.h 4 | * 5 | * \brief 6 | * Input related definitions 7 | * 8 | * \author 9 | * 10 | ************************************************************************ 11 | */ 12 | 13 | #ifndef _INPUT_H_ 14 | #define _INPUT_H_ 15 | 16 | extern int testEndian(void); 17 | extern void initInput(VideoParameters *p_Vid, FrameFormat *source, FrameFormat *output); 18 | extern void AllocateFrameMemory (VideoParameters *p_Vid, InputParameters *p_Inp, FrameFormat *source); 19 | extern void DeleteFrameMemory (VideoParameters *p_Vid); 20 | 21 | extern int read_one_frame (VideoParameters *p_Vid, VideoDataFile *input_file, int FrameNoInFile, int HeaderSize, FrameFormat *source, FrameFormat *output, imgpel **pImage[3]); 22 | extern void pad_borders ( FrameFormat output, int img_size_x, int img_size_y, int img_size_x_cr, int img_size_y_cr, imgpel **pImage[3]); 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /lencod/inc/context_ini.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************* 4 | * \file context_ini.h 5 | * 6 | * \brief 7 | * CABAC context initializations 8 | * 9 | * \author 10 | * Main contributors (see contributors.h for copyright, address and affiliation details) 11 | * - Detlev Marpe 12 | * - Heiko Schwarz 13 | ************************************************************************************** 14 | */ 15 | 16 | #ifndef _CONTEXT_INI_ 17 | #define _CONTEXT_INI_ 18 | 19 | extern void create_context_memory (VideoParameters *p_Vid, InputParameters *p_Inp); 20 | extern void free_context_memory (VideoParameters *p_Vid); 21 | extern void update_field_frame_contexts (VideoParameters *p_Vid, int); 22 | extern void SetCtxModelNumber (Slice *currSlice); 23 | extern void init_contexts (Slice *currSlice); 24 | extern void store_contexts (Slice *currSlice); 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /ldecod/inc/output.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************** 4 | * \file 5 | * output.h 6 | * \brief 7 | * Picture writing routine headers 8 | * \author 9 | * Main contributors (see contributors.h for copyright, address and affiliation details) 10 | * - Karsten Suehring 11 | *************************************************************************************** 12 | */ 13 | 14 | #ifndef _OUTPUT_H_ 15 | #define _OUTPUT_H_ 16 | 17 | 18 | extern void write_stored_frame(VideoParameters *p_Vid, FrameStore *fs, int p_out); 19 | extern void direct_output (VideoParameters *p_Vid, StorablePicture *p, int p_out); 20 | extern void init_out_buffer (VideoParameters *p_Vid); 21 | extern void uninit_out_buffer (VideoParameters *p_Vid); 22 | #if (PAIR_FIELDS_IN_OUTPUT) 23 | extern void flush_pending_output(VideoParameters *p_Vid, int p_out); 24 | #endif 25 | extern void init_output(CodingParameters *p_CodingParams, int symbol_size_in_bytes); 26 | #endif //_OUTPUT_H_ 27 | -------------------------------------------------------------------------------- /lencod/inc/rd_intra_jm.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * rd_intra_jm.h 5 | * 6 | * \author 7 | * Alexis Michael Tourapis 8 | * 9 | * \date 10 | * 2 January 2008 11 | * 12 | * \brief 13 | * Headerfile for JM rd based intra mode decision 14 | ************************************************************************** 15 | */ 16 | 17 | #ifndef _RD_INTRA_JM_H_ 18 | #define _RD_INTRA_JM_H_ 19 | 20 | extern int mode_decision_for_I16x16_MB_RDO (Macroblock *currMB, int lambda); 21 | extern int mode_decision_for_I16x16_MB (Macroblock *currMB, int lambda); 22 | extern int mode_decision_for_I4x4_blocks_JM_High (Macroblock *currMB, int b8, int b4, int lambda, distblk* min_cost); 23 | extern int mode_decision_for_I4x4_blocks_JM_Low (Macroblock *currMB, int b8, int b4, int lambda, distblk* min_cost); 24 | extern int find_best_mode_I16x16_MB (Macroblock *currMB, int lambda, distblk min_cost); 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /lencod/inc/hme_distortion.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * hme_distortion.h 5 | * 6 | * \author 7 | * Yuwen He 8 | * Alexis Michael Tourapis 9 | * 10 | * \date 11 | * 11. August 2006 / Updated 18. December 2013 12 | * 13 | * \brief 14 | * Headerfile for motion estimation distortion 15 | ************************************************************************** 16 | */ 17 | 18 | #ifndef _HME_DISTORTION_H_ 19 | #define _HME_DISTORTION_H_ 20 | 21 | 22 | //only use integer pel reference frame memory; 23 | static inline imgpel *UMVLine4X_int_hme(StorablePicture *ref, MEBlock *mv_block, int y, int x) 24 | { 25 | return &(ref->pHmeImage[mv_block->hme_level][iClip3(-IMG_PAD_SIZE_Y, mv_block->hme_ref_size_y_max, y >> 2)][iClip3(-IMG_PAD_SIZE_X, mv_block->hme_ref_size_x_max, x >> 2)]); 26 | } 27 | 28 | 29 | // SAD functions 30 | 31 | extern distblk computeSAD_hme(StorablePicture *ref1, MEBlock*, distblk, MotionVector *); 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /lencod/inc/img_distortion.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file img_distortion.h 5 | * 6 | * \brief 7 | * Distortion related definitions 8 | * 9 | * \author 10 | * Main contributors (see contributors.h for copyright, address and affiliation details) 11 | * - Alexis Michael Tourapis 12 | * - Woo-Shik Kim 13 | * 14 | ************************************************************************ 15 | */ 16 | 17 | #ifndef _IMG_DISTORTION_H_ 18 | #define _IMG_DISTORTION_H_ 19 | 20 | extern void accumulate_avslice(DistMetric metric[3], int slice_type, int frames); 21 | extern void accumulate_average(DistMetric metric[3], int frames); 22 | extern void find_distortion (VideoParameters *p_Vid, ImageData *imgData); 23 | extern void select_img (VideoParameters *p_Vid, ImageStructure *imgSRC, ImageStructure *imgREF, ImageData *imgData); 24 | extern void compute_distortion(VideoParameters *p_Vid, ImageData *imgData); 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /lcommon/inc/resize.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************************* 3 | * \file resize.h 4 | * 5 | * \brief 6 | * Common type definitions 7 | * Currently only supports Windows and Linux operating systems. 8 | * Need to add support for other "older systems such as VAX, DECC, Unix Alpha etc 9 | * 10 | * \author 11 | * Main contributors (see contributors.h for copyright, address and affiliation details) 12 | * - Yuwen He 13 | ************************************************************************************* 14 | */ 15 | 16 | #ifndef _RESIZE_H_ 17 | #define _RESIZE_H_ 18 | extern int PyrDownG5x5_U8CnR( const imgpel* src, 19 | int srcstep, //stride of source in bytes; 20 | int width, //width of source; 21 | int height, //height of source; 22 | imgpel* dst, 23 | int dststep, 24 | int Cs 25 | ); 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /lencod/inc/lambda.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * lambda.h 5 | * 6 | * \date 7 | * 13 September 2009 8 | * 9 | * \brief 10 | * Headerfile for lagrangian lambda related computations 11 | * \author 12 | * Main contributors (see contributors.h for copyright, address and affiliation details) 13 | * - Alexis Michael Tourapis 14 | 15 | ************************************************************************** 16 | */ 17 | 18 | #ifndef _LAMBDA_H_ 19 | #define _LAMBDA_H_ 20 | 21 | #include "global.h" 22 | 23 | extern void get_implicit_lambda_p_slice (Slice *currSlice); 24 | extern void get_implicit_lambda_b_slice (Slice *currSlice); 25 | extern void get_implicit_lambda_i_slice (Slice *currSlice); 26 | extern void get_implicit_lambda_sp_slice(Slice *currSlice); 27 | extern void get_explicit_lambda (Slice *currSlice); 28 | extern void get_fixed_lambda (Slice *currSlice); 29 | extern void set_rdoq_lambda (Slice *currSlice); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /lencod/inc/intra4x4.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file intra4x4.h 5 | * 6 | * \brief 7 | * intra 4x4 functions 8 | * 9 | * \author 10 | * - Alexis Michael Tourapis 11 | * 12 | ************************************************************************ 13 | */ 14 | 15 | #ifndef _INTRA4x4_H_ 16 | #define _INTRA4x4_H_ 17 | 18 | // intra 4x4 generation function 19 | extern void set_intrapred_4x4_mbaff(Macroblock *currMB, ColorPlane pl, int img_x, int img_y, int *left_available, int *up_available, int *all_available); 20 | extern void set_intrapred_4x4 (Macroblock *currMB, ColorPlane pl, int img_x, int img_y, int *left_available, int *up_available, int *all_available); 21 | extern void get_intrapred_4x4 (Macroblock *currMB, ColorPlane pl, int i4x4_mode, int img_x, int img_y, int left_available, int up_available); 22 | 23 | // 4x4 residual generation 24 | extern void generate_pred_error_4x4(imgpel **cur_img, imgpel **prd_img, imgpel **cur_prd, int **mb_rres, int pic_opix_x, int block_x); 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /lencod/inc/errdo_dist_mhyp.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************** 3 | * \file errdo_dist_mhyp.h 4 | * \brief 5 | * Header file for distortion estimation with multiple decoder based method 6 | * 7 | * \author 8 | * Main contributors (see contributors.h for copyright, address and affiliation details) 9 | * - Zhifeng Chen 10 | * 11 | ************************************************************************** 12 | */ 13 | 14 | #ifndef _ERRDO_DIST_MHYP_H_ 15 | #define _ERRDO_DIST_MHYP_H_ 16 | 17 | extern void errdo_store_best_block_multihyp (InputParameters *p_Inp, imgpel*** mbY, imgpel*** dec_img, int block, int img_i, int img_j, int block_size); 18 | extern void errdo_get_best_block_multihyp (Macroblock *currMB, imgpel*** dec_img, imgpel*** mbY, int block, int block_size); 19 | extern distblk errdo_distortion_estimation_multihyp(Macroblock *currMB, int block, int block_size, short mode, short pdir, distblk min_rdcost); 20 | extern void copy_conceal_picture (VideoParameters *p_Vid, StorablePicture *enc_pic, int decoder); 21 | #endif 22 | -------------------------------------------------------------------------------- /lencod/inc/mode_decision_p8x8.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * mode_decision_p8x8.h 5 | * 6 | * \author 7 | * Main contributors (see contributors.h for copyright, address and affiliation details) 8 | * - Alexis Michael Tourapis 9 | * 10 | * \date 11 | * 1 September 2009 12 | * 13 | * \brief 14 | * Headerfile for 8x8 mode decision 15 | ************************************************************************** 16 | */ 17 | 18 | #ifndef _MODE_DECISION_P8x8_H_ 19 | #define _MODE_DECISION_P8x8_H_ 20 | 21 | //==== MODULE PARAMETERS ==== 22 | extern void submacroblock_mode_decision_p_slice (Macroblock *currMB, RD_PARAMS *, RD_8x8DATA *, int ****, int, distblk *); 23 | extern void submacroblock_mode_decision_b_slice (Macroblock *currMB, RD_PARAMS *, RD_8x8DATA *, int ****, int, distblk *); 24 | extern void submacroblock_mode_decision_low(Macroblock *currMB, RD_PARAMS *, RD_8x8DATA *, int ****, int *, int, distblk *, distblk *, distblk *, int); 25 | extern void copy_part_info(Info8x8 *b8x8, Info8x8 *part); 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /COPYRIGHT_ISO_IEC.txt: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Software Copyright Licensing Disclaimer 3 | * 4 | * This software module was originally developed by contributors to the 5 | * course of the development of ISO/IEC 14496-10 for reference purposes 6 | * and its performance may not have been optimized. This software 7 | * module is an implementation of one or more tools as specified by 8 | * ISO/IEC 14496-10. ISO/IEC gives users free license to this software 9 | * module or modifications thereof. Those intending to use this software 10 | * module in products are advised that its use may infringe existing 11 | * patents. ISO/IEC have no liability for use of this software module 12 | * or modifications thereof. The original contributors retain full 13 | * rights to modify and use the code for their own purposes, and to 14 | * assign or donate the code to third-parties. 15 | * 16 | * This copyright notice must be included in all copies or derivative 17 | * works. Copyright (c) ISO/IEC 2004, 2005, 2006, 2007, 2008. 18 | **********************************************************************/ 19 | -------------------------------------------------------------------------------- /disclaimer.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * Disclaimer of Warranty 3 | * 4 | * These software programs are available to the user without any 5 | * license fee or royalty on an "as is" basis. The ITU-T 6 | * disclaims any and all warranties, whether express, implied, or 7 | * statutory, including any implied warranties of merchantability 8 | * or of fitness for a particular purpose. In no event shall the 9 | * copyright-holder be liable for any incidental, punitive, or 10 | * consequential damages of any kind whatsoever arising from the 11 | * use of these programs. 12 | * 13 | * This disclaimer of warranty extends to the user of these programs 14 | * and user's customers, employees, agents, transferees, successors, 15 | * and assigns. 16 | * 17 | * The ITU-T does not represent or warrant that the programs furnished 18 | * hereunder are free of infringement of any third-party patents. 19 | * Commercial implementations of ITU-T standards, including shareware, 20 | * may be subject to royalty fees to patent holders. Information 21 | * regarding the ITU patent policy is available from the ITU 22 | * Web site at http://www.itu.int. 23 | * 24 | */ 25 | 26 | -------------------------------------------------------------------------------- /lcommon/inc/img_io.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************************* 3 | * \file img_io.h 4 | * 5 | * \brief 6 | * image I/O related functions 7 | * 8 | * \author 9 | * Main contributors (see contributors.h for copyright, address and affiliation details) 10 | * - Alexis Michael Tourapis 11 | ************************************************************************************* 12 | */ 13 | #include "global.h" 14 | 15 | #ifndef _IMG_IO_H_ 16 | #define _IMG_IO_H_ 17 | 18 | #include "io_video.h" 19 | #include "io_raw.h" 20 | #include "io_tiff.h" 21 | 22 | extern int ParseSizeFromString (VideoDataFile *input_file, int *xlen, int *ylen, double *fps); 23 | extern void ParseFrameNoFormatFromString (VideoDataFile *input_file); 24 | extern void OpenFrameFile (VideoDataFile *input_file, int FrameNumberInFile); 25 | extern void OpenFiles (VideoDataFile *input_file); 26 | extern void CloseFiles (VideoDataFile *input_file); 27 | extern VideoFileType ParseVideoType (VideoDataFile *input_file); 28 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /lencod/inc/leaky_bucket.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | *************************************************************************** 4 | * 5 | * \file leaky_bucket.h 6 | * 7 | * \brief 8 | * Header for Leaky Buffer parameters 9 | * 10 | * \author 11 | * Main contributors (see contributors.h for copyright, address and affiliation details) 12 | * - Shankar Regunathan 13 | **************************************************************************/ 14 | 15 | #ifndef _LEAKY_BUCKET_H_ 16 | #define _LEAKY_BUCKET_H_ 17 | 18 | 19 | /* Leaky Bucket Parameter Optimization */ 20 | #ifdef _LEAKYBUCKET_ 21 | extern int get_LeakyBucketRate(InputParameters *p_Inp, unsigned long NumberLeakyBuckets, unsigned long *Rmin); 22 | extern void PutBigDoubleWord (unsigned long dw, FILE *fp); 23 | extern void write_buffer (InputParameters *p_Inp, unsigned long NumberLeakyBuckets, unsigned long Rmin[], unsigned long Bmin[], unsigned long Fmin[]); 24 | extern void Sort (unsigned long NumberLeakyBuckets, unsigned long *Rmin); 25 | extern void calc_buffer (VideoParameters *p_Vid, InputParameters *p_Inp); 26 | #endif 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /lencod/inc/output.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************** 4 | * \file 5 | * output.h 6 | * \brief 7 | * Picture writing routine headers 8 | * \author 9 | * Main contributors (see contributors.h for copyright, address and affiliation details) 10 | * - Karsten Suehring 11 | *************************************************************************************** 12 | */ 13 | 14 | #ifndef _OUTPUT_H_ 15 | #define _OUTPUT_H_ 16 | 17 | extern void flush_direct_output(VideoParameters *p_Vid, FrameFormat *output, int p_out); 18 | extern void write_out_picture ( StorablePicture *p, FrameFormat *output, int p_out); 19 | extern void write_stored_frame (VideoParameters *p_Vid, FrameStore *fs, FrameFormat *output, int p_out); 20 | extern void direct_output (VideoParameters *p_Vid, StorablePicture *p, FrameFormat *output, int p_out); 21 | extern void direct_output_paff (VideoParameters *p_Vid, StorablePicture *p, FrameFormat *output, int p_out); 22 | extern void init_out_buffer (VideoParameters *p_Vid); 23 | extern void uninit_out_buffer (VideoParameters *p_Vid); 24 | 25 | 26 | #endif //_OUTPUT_H_ 27 | -------------------------------------------------------------------------------- /lencod/inc/quant8x8.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file quant8x8.h 5 | * 6 | * \brief 7 | * Quantization process header file 8 | * 9 | * \author 10 | * Alexis Michael Tourapis 11 | * 12 | ************************************************************************ 13 | */ 14 | 15 | #ifndef _QUANT8x8_H_ 16 | #define _QUANT8x8_H_ 17 | 18 | extern void init_quant_8x8 (Slice *currSlice); 19 | 20 | extern int quant_8x8_normal (Macroblock *currMB, int **tblock, struct quant_methods *q_method); 21 | extern int quant_8x8_around (Macroblock *currMB, int **tblock, struct quant_methods *q_method); 22 | extern int quant_8x8_trellis(Macroblock *currMB, int **tblock, struct quant_methods *q_method); 23 | 24 | extern int quant_8x8cavlc_around (Macroblock *currMB, int **tblock, struct quant_methods *q_method, int*** cofAC); 25 | extern int quant_8x8cavlc_normal (Macroblock *currMB, int **tblock, struct quant_methods *q_method, int*** cofAC); 26 | extern int quant_8x8cavlc_trellis(Macroblock *currMB, int **tblock, struct quant_methods *q_method, int*** cofAC); 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /lencod/inc/q_around.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * q_around.h 5 | * 6 | * \author 7 | * Alexis Michael Tourapis 8 | * 9 | * \brief 10 | * Headerfile for Quantization Adaptive Rounding 11 | ************************************************************************** 12 | */ 13 | 14 | #ifndef _Q_AROUND_H_ 15 | #define _Q_AROUND_H_ 16 | 17 | extern void update_adaptive_rounding_8x8 (VideoParameters *p_Vid, InputParameters *p_Inp, RD_8x8DATA* dataTr, int**** ARCofAdj); 18 | extern void store_adaptive_rounding_4x4 (VideoParameters *p_Vid, int****ARCofAdj, int mode, int block_y, int block_x); 19 | extern void update_adaptive_rounding_4x4 (VideoParameters *p_Vid, int****ARCofAdj , int mode, int block_y, int block_x); 20 | extern void update_adaptive_rounding_16x16(VideoParameters *p_Vid, int****ARCofAdj , int mode); 21 | extern void store_adaptive_rounding_16x16 (VideoParameters *p_Vid, int****ARCofAdj, int mode); 22 | extern void reset_adaptive_rounding_direct(VideoParameters *p_Vid); 23 | extern void update_offset_params (Macroblock *currMB, int mode, byte luma_transform_size_8x8_flag); 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /ldecod/inc/annexb.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************* 4 | * \file annexb.h 5 | * 6 | * \brief 7 | * Annex B byte stream buffer handling. 8 | * 9 | ************************************************************************************* 10 | */ 11 | 12 | #ifndef _ANNEXB_H_ 13 | #define _ANNEXB_H_ 14 | 15 | #include "nalucommon.h" 16 | 17 | typedef struct annex_b_struct 18 | { 19 | int BitStreamFile; //!< the bit stream file 20 | byte *iobuffer; 21 | byte *iobufferread; 22 | int bytesinbuffer; 23 | int is_eof; 24 | int iIOBufferSize; 25 | 26 | int IsFirstByteStreamNALU; 27 | int nextstartcodebytes; 28 | byte *Buf; 29 | } ANNEXB_t; 30 | 31 | extern int get_annex_b_NALU (VideoParameters *p_Vid, NALU_t *nalu, ANNEXB_t *annex_b); 32 | 33 | extern void open_annex_b (char *fn, ANNEXB_t *annex_b); 34 | extern void close_annex_b (ANNEXB_t *annex_b); 35 | extern void malloc_annex_b (VideoParameters *p_Vid, ANNEXB_t **p_annex_b); 36 | extern void free_annex_b (ANNEXB_t **p_annex_b); 37 | extern void init_annex_b (ANNEXB_t *annex_b); 38 | extern void reset_annex_b (ANNEXB_t *annex_b); 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /lencod/inc/explicit_seq.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************* 4 | * \file explicit_seq.h 5 | * 6 | * \brief 7 | * Functions for explicit sequence support 8 | * 9 | * \author 10 | * Main contributors (see contributors.h for copyright, address and affiliation details) 11 | * - Alexis Michael Tourapis 12 | ************************************************************************************* 13 | */ 14 | 15 | #ifndef _EXPLICIT_SEQ_H_ 16 | #define _EXPLICIT_SEQ_H_ 17 | 18 | // Definition of structures used for explicit sequence representation 19 | typedef struct 20 | { 21 | int seq_number; 22 | int slice_type; 23 | int is_idr; 24 | int reference_idc; 25 | int frame_qp; 26 | int deblocking; 27 | int is_field; 28 | } ExpFrameInfo; 29 | 30 | typedef struct exp_seq_info 31 | { 32 | int no_frames; 33 | ExpFrameInfo *info; 34 | } ExpSeqInfo; 35 | 36 | extern void ReadExplicitSeqFile (ExpSeqInfo *seq_info, FILE *exp_file, int coding_index); 37 | extern void OpenExplicitSeqFile (VideoParameters *p_Vid, InputParameters *p_Inp); 38 | extern void CloseExplicitSeqFile (VideoParameters *p_Vid); 39 | #endif 40 | -------------------------------------------------------------------------------- /lencod/inc/md_distortion.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * md_distortion.h 5 | * 6 | * \author 7 | * Alexis Michael Tourapis 8 | * 9 | * \date 10 | * 7. February 2009 11 | * 12 | * \brief 13 | * Headerfile for distortion functions 14 | ************************************************************************** 15 | */ 16 | 17 | #ifndef _MD_DISTORTION_H_ 18 | #define _MD_DISTORTION_H_ 19 | 20 | #include "global.h" 21 | 22 | // Functions 23 | extern void setupDistortion (Slice *currSlice); 24 | extern int64 compute_SSE (imgpel **imgRef, imgpel **imgSrc, int xRef, int xSrc, int ySize, int xSize); 25 | extern distblk compute_SSE_cr (imgpel **imgRef, imgpel **imgSrc, int xRef, int xSrc, int ySize, int xSize); 26 | extern distblk compute_SSE16x16(imgpel **imgRef, imgpel **imgSrc, int xRef, int xSrc); 27 | extern distblk compute_SSE8x8 (imgpel **imgRef, imgpel **imgSrc, int xRef, int xSrc); 28 | extern distblk compute_SSE4x4 (imgpel **imgRef, imgpel **imgSrc, int xRef, int xSrc); 29 | extern distblk compute_SSE16x16_thres(imgpel **imgRef, imgpel **imgSrc, int xRef, int xSrc, distblk min_cost); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /lcommon/inc/transform.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | *************************************************************************** 4 | * 5 | * \file transform.h 6 | * 7 | * \brief 8 | * prototypes of transform functions 9 | * 10 | * \date 11 | * 10 July 2007 12 | * 13 | * \author 14 | * Main contributors (see contributors.h for copyright, address and affiliation details) 15 | * Alexis Michael Tourapis 16 | **************************************************************************/ 17 | 18 | #ifndef _TRANSFORM_H_ 19 | #define _TRANSFORM_H_ 20 | 21 | extern void forward4x4 (int **block , int **tblock, int pos_y, int pos_x); 22 | extern void inverse4x4 (int **tblock, int **block , int pos_y, int pos_x); 23 | extern void forward8x8 (int **block , int **tblock, int pos_y, int pos_x); 24 | extern void inverse8x8 (int **tblock, int **block , int pos_x); 25 | extern void hadamard4x4 (int **block , int **tblock); 26 | extern void ihadamard4x4 (int **tblock, int **block); 27 | extern void hadamard4x2 (int **block , int **tblock); 28 | extern void ihadamard4x2 (int **tblock, int **block); 29 | extern void hadamard2x2 (int **block , int tblock[4]); 30 | extern void ihadamard2x2 (int block[4], int tblock[4]); 31 | 32 | #endif //_TRANSFORM_H_ 33 | -------------------------------------------------------------------------------- /ldecod/inc/dec_statistics.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************** 3 | * \file dec_statistics.h 4 | * 5 | * \brief 6 | * Various decoding statistics 7 | * 8 | * \author 9 | * Main contributors (see contributors.h for copyright, address and affiliation details) 10 | * - Alexis Tourapis 11 | * 12 | ************************************************************************** 13 | */ 14 | 15 | #ifndef _DEC_STATISTICS_H_ 16 | #define _DEC_STATISTICS_H_ 17 | #include "global.h" 18 | 19 | typedef struct dec_stat_parameters 20 | { 21 | int frame_ctr [NUM_SLICE_TYPES]; //!< Counter for different frame coding types (assumes one slice type per frame) 22 | int64 mode_use [NUM_SLICE_TYPES][MAXMODE]; //!< Macroblock mode usage per slice 23 | int64 mode_use_transform [NUM_SLICE_TYPES][MAXMODE][2]; 24 | 25 | int64 *histogram_mv [2][2]; //!< mv histogram (per list and per direction) 26 | int64 *histogram_refs[2]; //!< reference histogram (per list) 27 | } DecStatParameters; 28 | 29 | extern void init_dec_stats (DecStatParameters *stats); 30 | extern void delete_dec_stats(DecStatParameters *stats); 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /lencod/inc/intra8x8.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * 4 | * \file intra8x8.h 5 | * 6 | * \brief 7 | * prototypes of 8x8 intra prediction 8 | * 9 | * \date 10 | * 5. February 2009 11 | * 12 | * \author 13 | * Main contributors (see contributors.h for copyright, address and affiliation details) 14 | * Alexis Michael Tourapis 15 | **************************************************************************/ 16 | 17 | #ifndef _INTRA8X8_H_ 18 | #define _INTRA8X8_H_ 19 | 20 | extern void set_intrapred_8x8_mbaff (Macroblock *currMB, ColorPlane pl, int img_x,int img_y, int *left_available, int *up_available, int *up_left_available); 21 | extern void set_intrapred_8x8 (Macroblock *currMB, ColorPlane pl, int img_x,int img_y, int *left_available, int *up_available, int *up_left_available); 22 | extern void get_intrapred_8x8 (Macroblock *currMB, ColorPlane pl, int i8x8_mode, int left_available, int up_available); 23 | extern void LowPassForIntra8x8Pred (imgpel *PredPel, int block_up_left, int block_up, int block_left); 24 | 25 | extern void generate_pred_error_8x8 (imgpel **cur_img, imgpel **prd_img, imgpel **cur_prd, int **mb_rres, int pic_opix_x, int block_x); 26 | 27 | #endif //_TRANSFORM8X8_H_ 28 | -------------------------------------------------------------------------------- /lencod/inc/symbol.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | *************************************************************************** 4 | * 5 | * \file symbol.h 6 | * 7 | * \brief 8 | * Generic Symbol writing interface 9 | * 10 | * \date 11 | * 18 Jan 2006 12 | * 13 | * \author 14 | * Karsten Suehring 15 | **************************************************************************/ 16 | struct writeMB { 17 | void (*writeMB_typeInfo) (Macroblock *currMB, SyntaxElement *se, DataPartition *dP); 18 | void (*writeIntraPredMode) (SyntaxElement *se, DataPartition *dP); 19 | void (*writeB8_typeInfo) (SyntaxElement *se, DataPartition *dP); 20 | void (*writeRefFrame[6]) (Macroblock *currMB, SyntaxElement *se, DataPartition *dP); 21 | void (*writeMVD) (Macroblock *currMB, SyntaxElement *se, DataPartition *dP); 22 | void (*writeCBP) (Macroblock* currMB, SyntaxElement *se, DataPartition *dP); 23 | void (*writeDquant) (Macroblock* currMB, SyntaxElement *se, DataPartition *dP); 24 | void (*writeCIPredMode) (Macroblock* currMB, SyntaxElement *se, DataPartition *dP); 25 | void (*writeFieldModeInfo) (Macroblock *currMB, SyntaxElement *se, DataPartition *dP); 26 | void (*writeMB_transform_size)(Macroblock *currMB, SyntaxElement *se, DataPartition *dP); 27 | }; 28 | -------------------------------------------------------------------------------- /ldecod/inc/h264decoder.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file 5 | * h264decoder.h 6 | * \brief 7 | * interface for H.264 decoder. 8 | * \author 9 | * Copyright (C) 2009 Dolby 10 | * Yuwen He (yhe@dolby.com) 11 | * 12 | ************************************************************************ 13 | */ 14 | #ifndef _H264DECODER_H_ 15 | #define _H264DECODER_H_ 16 | 17 | #include "global.h" 18 | 19 | typedef enum 20 | { 21 | DEC_GEN_NOERR = 0, 22 | DEC_OPEN_NOERR = 0, 23 | DEC_CLOSE_NOERR = 0, 24 | DEC_SUCCEED = 0, 25 | DEC_EOS =1, 26 | DEC_NEED_DATA = 2, 27 | DEC_INVALID_PARAM = 3, 28 | DEC_ERRMASK = 0x8000 29 | // DEC_ERRMASK = 0x80000000 30 | }DecErrCode; 31 | 32 | typedef struct dec_set_t 33 | { 34 | int iPostprocLevel; // valid interval are [0..100] 35 | int bDBEnable; 36 | int bAllLayers; 37 | int time_incr; 38 | int bDecCompAdapt; 39 | } DecSet_t; 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | int OpenDecoder(InputParameters *p_Inp); 46 | int DecodeOneFrame(DecodedPicList **ppDecPic); 47 | int FinitDecoder(DecodedPicList **ppDecPicList); 48 | int CloseDecoder(); 49 | int SetOptsDecoder(DecSet_t *pDecOpts); 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | #endif 55 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ### 2 | ### Makefile for JM H.264/AVC encoder/decoder 3 | ### 4 | ### generated for UNIX/LINUX environments 5 | ### by Limin Wang(lance.lmwang@gmail.com) 6 | ### 7 | 8 | SUBDIRS := lencod ldecod rtpdump rtp_loss 9 | 10 | ### include debug information: 1=yes, 0=no 11 | DBG?= 0 12 | ### enforce 32-bit build : 1=yes, 0=no 13 | M32?= 0 14 | ### static link : 1=yes, 0=no 15 | STC?= 0 16 | ### OPENMP support : 1=yes, 0=no 17 | OPENMP?= 0 18 | 19 | #check for LLVM and silence warnings accordingly 20 | LLVM = $(shell $(CC) --version | grep LLVM) 21 | ifneq ($(LLVM),) 22 | CFLAGS+=-Qunused-arguments 23 | else 24 | CFLAGS+=-Wno-unused-but-set-variable 25 | endif 26 | 27 | export DBG 28 | export STC 29 | export M32 30 | export OPENMP 31 | export CFLAGS 32 | 33 | .PHONY: default all distclean clean tags depend $(SUBDIRS) 34 | 35 | default: all 36 | 37 | all: $(SUBDIRS) 38 | 39 | $(SUBDIRS): 40 | $(MAKE) -C $@ 41 | 42 | clean depend: 43 | @echo "Cleaning dependencies" 44 | @for i in $(SUBDIRS); do make -C $$i $@; done 45 | 46 | tags: 47 | @echo "update tag table at top directory" 48 | @ctags -R . 49 | @for i in $(SUBDIRS); do make -C $$i $@; done 50 | 51 | distclean: clean 52 | @echo "Cleaning all" 53 | @rm -f tags 54 | @for i in $(SUBDIRS); do make -C $$i $@; done 55 | 56 | -------------------------------------------------------------------------------- /lcommon/inc/quant_params.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * quant_params.h 5 | * 6 | * \author 7 | * Alexis Michael Tourapis 8 | * 9 | * \brief 10 | * Headerfile for Quantization parameters 11 | ************************************************************************** 12 | */ 13 | 14 | #ifndef _QUANT_PARAMS_H_ 15 | #define _QUANT_PARAMS_H_ 16 | 17 | typedef struct level_quant_params { 18 | int OffsetComp; 19 | int ScaleComp; 20 | int InvScaleComp; 21 | } LevelQuantParams; 22 | 23 | typedef struct quant_params { 24 | int AdaptRndWeight; 25 | int AdaptRndCrWeight; 26 | 27 | LevelQuantParams *****q_params_4x4; 28 | LevelQuantParams *****q_params_8x8; 29 | 30 | int *qp_per_matrix; 31 | int *qp_rem_matrix; 32 | 33 | short **OffsetList4x4input; 34 | short **OffsetList8x8input; 35 | short ***OffsetList4x4; 36 | short ***OffsetList8x8; 37 | } QuantParameters; 38 | 39 | typedef struct quant_methods { 40 | int block_y; 41 | int block_x; 42 | int qp; 43 | int* ACLevel; 44 | int* ACRun; 45 | int **fadjust; 46 | LevelQuantParams **q_params; 47 | int *coeff_cost; 48 | const byte (*pos_scan)[2]; 49 | const byte *c_cost; 50 | char type; 51 | } QuantMethods; 52 | 53 | #endif 54 | 55 | -------------------------------------------------------------------------------- /rtpdump/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : rtpdump 3 | ======================================================================== 4 | 5 | 6 | AppWizard has created this rtpdump application for you. 7 | 8 | This file contains a summary of what you will find in each of the files that 9 | make up your rtpdump application. 10 | 11 | rtpdump.dsp 12 | This file (the project file) contains information at the project level and 13 | is used to build a single project or subproject. Other users can share the 14 | project (.dsp) file, but they should export the makefiles locally. 15 | 16 | rtpdump.cpp 17 | This is the main application source file. 18 | 19 | 20 | ///////////////////////////////////////////////////////////////////////////// 21 | Other standard files: 22 | 23 | StdAfx.h, StdAfx.cpp 24 | These files are used to build a precompiled header (PCH) file 25 | named rtpdump.pch and a precompiled types file named StdAfx.obj. 26 | 27 | 28 | ///////////////////////////////////////////////////////////////////////////// 29 | Other notes: 30 | 31 | AppWizard uses "TODO:" to indicate parts of the source code you 32 | should add to or customize. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | -------------------------------------------------------------------------------- /lencod/inc/refbuf_otf.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file refbuf_otf.h 5 | * 6 | * \brief 7 | * Declarations of the reference frame buffer types and functions for on-the-fly interpolations 8 | ************************************************************************ 9 | */ 10 | #ifndef _REBUF_OTF_H_ 11 | #define _REBUF_OTF_H_ 12 | 13 | #include "mbuffer.h" 14 | 15 | static inline imgpel *UMVLine4X_otf (StorablePicture *ref, int y, int x ) 16 | { 17 | return &(ref->p_curr_img_sub[(y & 0x03)>>1][(x & 0x03)>>1][iClip3( -IMG_PAD_SIZE_Y, ref->size_y_pad, y >> 2)][iClip3(-IMG_PAD_SIZE_X, ref->size_x_pad, x >> 2)]); 18 | } 19 | 20 | static inline imgpel *UMVLine4Xcr_otf (StorablePicture *ref, int cmp, int y, int x) 21 | { 22 | return &(ref->p_img_sub[cmp][(y & 0x03)>>1][(x & 0x03)>>1][iClip3(-ref->pad_size_uv_y, ref->size_y_cr_pad, y >> 2)][iClip3(-ref->pad_size_uv_x, ref->size_x_cr_pad, x >> 2)]); 23 | } 24 | 25 | static inline imgpel *UMVLine8X_chroma_otf (StorablePicture *ref, int cmp, int y, int x) 26 | { 27 | return &(ref->p_img_sub[cmp][(y & ref->chroma_mask_mv_y)>>1][(x & ref->chroma_mask_mv_x)>>1][iClip3 (-ref->pad_size_uv_y, ref->size_y_cr_pad, y >> ref->chroma_shift_y)][iClip3 (-ref->pad_size_uv_x, ref->size_x_cr_pad, x >> ref->chroma_shift_x)]); 28 | } 29 | 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /lencod/inc/me_fullsearch.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file 5 | * me_fullsearch.h 6 | * 7 | * \author 8 | * Alexis Michael Tourapis 9 | * 10 | * \date 11 | * 9 September 2006 12 | * 13 | * \brief 14 | * Headerfile for Full Search motion estimation 15 | ************************************************************************** 16 | */ 17 | 18 | 19 | #ifndef _ME_FULLSEARCH_H_ 20 | #define _ME_FULLSEARCH_H_ 21 | extern distblk full_search_motion_estimation (Macroblock *, MotionVector *, MEBlock *, distblk, int ); 22 | extern distblk full_search_bipred_motion_estimation (Macroblock *, int, MotionVector *, MotionVector *, MotionVector *, MotionVector *, MEBlock *, int, distblk, int ); 23 | extern distblk sub_pel_motion_estimation (Macroblock *, MotionVector *, MEBlock *, distblk, int *); 24 | extern distblk sub_pel_bipred_motion_estimation (Macroblock *, MEBlock *, int, MotionVector *, MotionVector *, MotionVector *, MotionVector *, distblk, int *); 25 | extern distblk full_sub_pel_motion_estimation (Macroblock *, MotionVector *, MEBlock *, distblk, int *); 26 | extern distblk full_sub_pel_bipred_motion_estimation (Macroblock *, MEBlock *, int, MotionVector *, MotionVector *, MotionVector *, MotionVector *, distblk, int *); 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /lencod/inc/mmco.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************************** 3 | * \file 4 | * mmco.h 5 | * \brief 6 | * MMCO example operations. 7 | * 8 | * \author 9 | * Main contributors (see contributors.h for copyright, address and affiliation details) 10 | * - Alexis Michael Tourapis 11 | * - Athanasios Leontaris 12 | *************************************************************************************** 13 | */ 14 | 15 | #ifndef _MMCO_H_ 16 | #define _MMCO_H_ 17 | 18 | extern void mmco_long_term(VideoParameters *p_Vid, int current_pic_num); 19 | extern void poc_based_ref_management_frame_pic(DecodedPictureBuffer *p_Dpb, int current_pic_num); 20 | #if CRA 21 | extern void cra_ref_management_frame_pic(DecodedPictureBuffer *p_Dpb, int current_pic_num); 22 | #endif 23 | #if HM50_LIKE_MMCO 24 | extern void hm50_ref_management_frame_pic(DecodedPictureBuffer *p_Dpb, int current_pic_num); 25 | #endif 26 | #if LD_REF_SETTING 27 | extern void low_delay_ref_management_frame_pic(DecodedPictureBuffer *p_Dpb, int current_pic_num); 28 | #endif 29 | extern void poc_based_ref_management_field_pic(DecodedPictureBuffer *p_Dpb, int current_pic_num); 30 | extern void tlyr_based_ref_management_frame_pic(VideoParameters *p_Vid, int current_pic_num); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /lencod/inc/intra16x16.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * 4 | * \file intra16x16.h 5 | * 6 | * \brief 7 | * prototypes of 16x16 intra prediction 8 | * 9 | * \date 10 | * 26 September 2009 11 | * 12 | * \author 13 | * Main contributors (see contributors.h for copyright, address and affiliation details) 14 | * Alexis Michael Tourapis 15 | **************************************************************************/ 16 | 17 | #ifndef _INTRA16X16_H_ 18 | #define _INTRA16X16_H_ 19 | 20 | extern distblk distI16x16_sad (Macroblock *currMB, imgpel **img_org, imgpel **pred_img, distblk min_cost); 21 | extern distblk distI16x16_sse (Macroblock *currMB, imgpel **img_org, imgpel **pred_img, distblk min_cost); 22 | extern distblk distI16x16_satd (Macroblock *currMB, imgpel **img_org, imgpel **pred_img, distblk min_cost); 23 | 24 | extern distblk find_sad_16x16_JM (Macroblock *currMB); 25 | 26 | extern void set_intrapred_16x16_mbaff (Macroblock *currMB, ColorPlane pl, int *left_available, int *up_available, int *all_available); 27 | extern void set_intrapred_16x16 (Macroblock *currMB, ColorPlane pl, int *left_available, int *up_available, int *all_available); 28 | extern void get_intrapred_16x16 (Macroblock *currMB, ColorPlane pl, int i16x16_mode, int left_available, int up_available); 29 | 30 | #endif //_INTRA16X16_H_ 31 | -------------------------------------------------------------------------------- /lcommon/inc/config_common.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file config_common.h 5 | * 6 | * \brief 7 | * Common Config parsing functions 8 | * 9 | * \author 10 | * Main contributors (see contributors.h for copyright, address and affiliation details) 11 | * - Alexis Tourapis 12 | * 13 | ************************************************************************ 14 | */ 15 | #ifndef _CONFIG_COMMON_H_ 16 | #define _CONFIG_COMMON_H_ 17 | 18 | //! Maps parameter name to its address, type etc. 19 | typedef struct { 20 | char *TokenName; //!< name 21 | void *Place; //!< address 22 | int Type; //!< type: 0-int, 1-char[], 2-double 23 | double Default; //!< default value 24 | int param_limits; //!< 0: no limits, 1: both min and max, 2: only min (i.e. no negatives), 3: special case for QPs since min needs bitdepth_qp_scale 25 | double min_limit; 26 | double max_limit; 27 | int char_size; //!< Dimension of type char[] 28 | } Mapping; 29 | 30 | extern char *GetConfigFileContent (char *Filename); 31 | extern int InitParams (Mapping *Map); 32 | extern int TestParams(Mapping *Map, int bitdepth_qp_scale[3]); 33 | extern int DisplayParams(Mapping *Map, char *message); 34 | extern void ParseContent (InputParameters *p_Inp, Mapping *Map, char *buf, int bufsize); 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /bin/q_matrix2.cfg: -------------------------------------------------------------------------------- 1 | # This is the configuration file for initialising the Q matrix. 2 | # Altogether 6 matrix for 4x4 block and 2 matrix for 8x8 block 3 | # The values range from 1 to 255 4 | # If first value of matrix is equal to 0, default values will be used for that matrix 5 | #################################################################################### 6 | 7 | INTRA4X4_LUMA = 8 | 7,16,22,24, 9 | 16,22,24,28, 10 | 18,22,27,33, 11 | 22,24,32,47 12 | 13 | INTRA4X4_CHROMAU = 14 | 7,16,22,24, 15 | 16,22,24,28, 16 | 18,22,27,33, 17 | 22,24,32,47 18 | 19 | INTRA4X4_CHROMAV = 20 | 7,16,22,24, 21 | 16,22,24,28, 22 | 18,22,27,33, 23 | 22,24,32,47 24 | 25 | INTER4X4_LUMA = 26 | 13,15,17,18, 27 | 15,17,18,20, 28 | 17,18,21,22, 29 | 18,20,22,25 30 | 31 | INTER4X4_CHROMAU = 32 | 13,15,17,18, 33 | 15,17,18,20, 34 | 17,18,21,22, 35 | 18,20,22,25 36 | 37 | INTER4X4_CHROMAV = 38 | 13,15,17,18, 39 | 15,17,18,20, 40 | 17,18,21,22, 41 | 18,20,22,25 42 | 43 | INTRA8X8_LUMA = 44 | 7,13,16,18,22,22,24,28, 45 | 13,13,18,20,22,24,28,31, 46 | 16,18,22,22,24,28,28,32, 47 | 18,18,22,22,24,28,31,33, 48 | 18,22,22,24,27,29,33,40, 49 | 22,22,24,27,29,33,40,48, 50 | 22,22,24,28,32,38,47,57, 51 | 22,24,29,32,38,47,57,69 52 | 53 | INTER8X8_LUMA = 54 | 13,14,15,16,17,17,18,19, 55 | 14,15,16,17,17,18,19,20, 56 | 15,16,17,17,18,19,20,21, 57 | 16,17,17,18,19,20,21,22, 58 | 17,17,18,19,21,22,22,23, 59 | 17,18,19,20,22,22,23,25, 60 | 18,19,20,22,22,23,25,26, 61 | 19,20,21,22,23,25,26,27 62 | -------------------------------------------------------------------------------- /bin/q_matrix_def.cfg: -------------------------------------------------------------------------------- 1 | # This is the configuration file for initialising the Q matrix. 2 | # Altogether 6 matrix for 4x4 block and 2 matrix for 8x8 block 3 | # The values range from 1 to 255 4 | # If first value of matrix is equal to 0, default values will be used for that matrix 5 | #################################################################################### 6 | 7 | INTRA4X4_LUMA = 8 | 0,12,19,26, 9 | 12,19,26,31, 10 | 19,26,31,35, 11 | 26,31,35,39 12 | 13 | INTRA4X4_CHROMAU = 14 | 0,12,19,26, 15 | 12,19,26,31, 16 | 19,26,31,35, 17 | 26,31,35,39 18 | 19 | INTRA4X4_CHROMAV = 20 | 0,12,19,26, 21 | 12,19,26,31, 22 | 19,26,31,35, 23 | 26,31,35,39 24 | 25 | INTER4X4_LUMA = 26 | 0,13,18,21, 27 | 13,18,21,24, 28 | 18,21,24,27, 29 | 21,24,27,30 30 | 31 | INTER4X4_CHROMAU = 32 | 0,13,18,21, 33 | 13,18,21,24, 34 | 18,21,24,27, 35 | 21,24,27,30 36 | 37 | INTER4X4_CHROMAV = 38 | 0,13,18,21, 39 | 13,18,21,24, 40 | 18,21,24,27, 41 | 21,24,27,30 42 | 43 | INTRA8X8_LUMA = 44 | 0,10,13,16,19,24,26,28 45 | 10,12,16,19,24,26,28,31 46 | 13,16,19,24,26,28,31,33 47 | 16,19,24,26,28,31,33,35 48 | 19,24,26,28,31,33,35,37 49 | 24,26,28,31,33,35,37,39 50 | 26,28,31,33,35,37,39,42 51 | 28,31,33,35,37,39,42,44 52 | 53 | INTER8X8_LUMA = 54 | 0,12,14,16,18,19,21,22, 55 | 12,13,16,18,19,21,22,24, 56 | 14,16,18,19,21,22,24,25, 57 | 16,18,19,21,22,24,25,27, 58 | 18,19,21,22,24,25,27,28, 59 | 19,21,22,24,25,27,28,30, 60 | 21,22,24,25,27,28,30,31, 61 | 22,24,25,27,28,30,31,33 62 | -------------------------------------------------------------------------------- /lencod/inc/md_common.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * md_common.h 5 | * 6 | * \author 7 | * Main contributors (see contributors.h for copyright, address and affiliation details) 8 | * - Alexis Michael Tourapis 9 | * 10 | * \date 11 | * 4. October 2008 12 | * 13 | * \brief 14 | * Headerfile for common mode functions 15 | ************************************************************************** 16 | */ 17 | 18 | #ifndef _MD_COMMON_H_ 19 | #define _MD_COMMON_H_ 20 | #include "mv_search.h" 21 | #include "me_distortion.h" 22 | 23 | extern void SetMotionVectorsMBPSlice (Macroblock* currMB); 24 | extern void SetMotionVectorsMBBSlice (Macroblock* currMB); 25 | extern void SetMotionVectorsMBISlice (Macroblock* currMB); 26 | extern void copy_image_data (imgpel **imgBuf1, imgpel **imgBuf2, int off1, int off2, int width, int height); 27 | extern void copy_image_data_16x16 (imgpel **imgBuf1, imgpel **imgBuf2, int off1, int off2); 28 | extern void copy_image_data_8x8 (imgpel **imgBuf1, imgpel **imgBuf2, int off1, int off2); 29 | extern void copy_image_data_4x4 (imgpel **imgBuf1, imgpel **imgBuf2, int off1, int off2); 30 | extern void ResetRD8x8Data (VideoParameters *p_Vid, RD_8x8DATA *rd_data); 31 | extern void set_chroma_pred_mode (Macroblock *currMB, RD_PARAMS enc_mb, int *mb_available, char chroma_pred_mode_range[2]); 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /ldecod/inc/mc_prediction.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************* 4 | * \file mc_prediction.h 5 | * 6 | * \brief 7 | * definitions for motion compensated prediction 8 | * 9 | * \author 10 | * Main contributors (see contributors.h for copyright, 11 | * address and affiliation details) 12 | * - Alexis Michael Tourapis 13 | * 14 | ************************************************************************************* 15 | */ 16 | 17 | #ifndef _MC_PREDICTION_H_ 18 | #define _MC_PREDICTION_H_ 19 | 20 | #include "global.h" 21 | #include "mbuffer.h" 22 | 23 | extern int allocate_pred_mem(Slice *currSlice); 24 | extern void free_pred_mem (Slice *currSlice); 25 | 26 | extern void get_block_luma(StorablePicture *curr_ref, int x_pos, int y_pos, int block_size_x, int block_size_y, imgpel **block, 27 | int shift_x,int maxold_x,int maxold_y,int **tmp_res,int max_imgpel_value,imgpel no_ref_value,Macroblock *currMB); 28 | 29 | extern void intra_cr_decoding (Macroblock *currMB, int yuv); 30 | extern void prepare_direct_params(Macroblock *currMB, StorablePicture *dec_picture, MotionVector *pmvl0, MotionVector *pmvl1,char *l0_rFrame, char *l1_rFrame); 31 | extern void perform_mc (Macroblock *currMB, ColorPlane pl, StorablePicture *dec_picture, int pred_dir, int i, int j, int block_size_x, int block_size_y); 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /COPYRIGHT_ITU.txt: -------------------------------------------------------------------------------- 1 | /* 2 | *********************************************************************** 3 | * COPYRIGHT AND WARRANTY INFORMATION 4 | * 5 | * Copyright 2001, International Telecommunications Union, Geneva 6 | * 7 | * DISCLAIMER OF WARRANTY 8 | * 9 | * These software programs are available to the user without any 10 | * license fee or royalty on an "as is" basis. The ITU disclaims 11 | * any and all warranties, whether express, implied, or 12 | * statutory, including any implied warranties of merchantability 13 | * or of fitness for a particular purpose. In no event shall the 14 | * contributor or the ITU be liable for any incidental, punitive, or 15 | * consequential damages of any kind whatsoever arising from the 16 | * use of these programs. 17 | * 18 | * This disclaimer of warranty extends to the user of these programs 19 | * and user's customers, employees, agents, transferees, successors, 20 | * and assigns. 21 | * 22 | * The ITU does not represent or warrant that the programs furnished 23 | * hereunder are free of infringement of any third-party patents. 24 | * Commercial implementations of ITU-T Recommendations, including 25 | * shareware, may be subject to royalty fees to patent holders. 26 | * Information regarding the ITU-T patent policy is available from 27 | * the ITU Web site at http://www.itu.int. 28 | * 29 | * THIS IS NOT A GRANT OF PATENT RIGHTS - SEE THE ITU-T PATENT POLICY. 30 | ************************************************************************ 31 | */ 32 | 33 | -------------------------------------------------------------------------------- /ldecod/inc/mbuffer_mvc.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | *********************************************************************** 4 | * \file 5 | * mbuffer_mvc.h 6 | * 7 | * \brief 8 | * MVC Frame buffer functions 9 | * 10 | * \author 11 | * Main contributors (see contributors.h for copyright, address and affiliation details) 12 | * - Athanasios Leontaris 13 | * - Karsten Suehring 14 | * - Alexis Michael Tourapis 15 | * 16 | *********************************************************************** 17 | */ 18 | #ifndef _MBUFFER_MVC_H_ 19 | #define _MBUFFER_MVC_H_ 20 | 21 | #include "global.h" 22 | 23 | #if (MVC_EXTENSION_ENABLE) 24 | extern void reorder_lists_mvc (Slice * currSlice, int currPOC); 25 | extern void init_lists_p_slice_mvc(Slice *currSlice); 26 | extern void init_lists_b_slice_mvc(Slice *currSlice); 27 | extern void init_lists_i_slice_mvc(Slice *currSlice); 28 | 29 | extern void reorder_ref_pic_list_mvc(Slice *currSlice, int cur_list, int **anchor_ref, int **non_anchor_ref, 30 | int view_id, int anchor_pic_flag, int currPOC, int listidx); 31 | 32 | extern void reorder_short_term(Slice *currSlice, int cur_list, int num_ref_idx_lX_active_minus1, int picNumLX, int *refIdxLX, int currViewID); 33 | extern void reorder_long_term(Slice *currSlice, StorablePicture **RefPicListX, int num_ref_idx_lX_active_minus1, int LongTermPicNum, int *refIdxLX, int currViewID); 34 | #endif 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /ldecod/src/intra_pred_common.c: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************************* 3 | * \file intra_pred_common.c 4 | * 5 | * \brief 6 | * functions for setting up intra prediction modes 7 | * 8 | * \author 9 | * Main contributors (see contributors.h for copyright, 10 | * address and affiliation details) 11 | * - Alexis Michael Tourapis 12 | * 13 | ************************************************************************************* 14 | */ 15 | #include "global.h" 16 | #include "intra4x4_pred.h" 17 | #include "intra8x8_pred.h" 18 | #include "intra16x16_pred.h" 19 | #include "mb_access.h" 20 | #include "image.h" 21 | 22 | 23 | extern void intra_pred_chroma (Macroblock *currMB); 24 | extern void intra_pred_chroma_mbaff(Macroblock *currMB); 25 | 26 | 27 | void set_intra_prediction_modes(Slice *currSlice) 28 | { 29 | if (currSlice->mb_aff_frame_flag) 30 | { 31 | currSlice->intra_pred_4x4 = intra_pred_4x4_mbaff; 32 | currSlice->intra_pred_8x8 = intra_pred_8x8_mbaff; 33 | currSlice->intra_pred_16x16 = intra_pred_16x16_mbaff; 34 | currSlice->intra_pred_chroma = intra_pred_chroma_mbaff; 35 | } 36 | else 37 | { 38 | currSlice->intra_pred_4x4 = intra_pred_4x4_normal; 39 | currSlice->intra_pred_8x8 = intra_pred_8x8_normal; 40 | currSlice->intra_pred_16x16 = intra_pred_16x16_normal; 41 | currSlice->intra_pred_chroma = intra_pred_chroma; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lencod/src/quant8x8.c: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************* 4 | * \file quant8x8.c 5 | * 6 | * \brief 7 | * Quantization process for a 8x8 block 8 | * 9 | * \author 10 | * Main contributors (see contributors.h for copyright, address and affiliation details) 11 | * - Alexis Michael Tourapis 12 | * 13 | ************************************************************************************* 14 | */ 15 | 16 | #include "contributors.h" 17 | 18 | #include 19 | 20 | #include "global.h" 21 | #include "quant8x8.h" 22 | 23 | 24 | /*! 25 | ************************************************************************ 26 | * \brief 27 | * Quantization initialization function 28 | * 29 | ************************************************************************ 30 | */ 31 | void init_quant_8x8(Slice *currSlice) 32 | { 33 | VideoParameters *p_Vid = currSlice->p_Vid; 34 | // We may wish to have all these parameters switched at the slice level for speed up. 35 | if (currSlice->UseRDOQuant == 1) 36 | { 37 | currSlice->quant_8x8 = quant_8x8_trellis; 38 | currSlice->quant_8x8cavlc = quant_8x8cavlc_trellis; 39 | } 40 | else if (p_Vid->AdaptiveRounding) 41 | { 42 | currSlice->quant_8x8 = quant_8x8_around; 43 | currSlice->quant_8x8cavlc = quant_8x8cavlc_around; 44 | } 45 | else 46 | { 47 | currSlice->quant_8x8 = quant_8x8_normal; 48 | currSlice->quant_8x8cavlc = quant_8x8cavlc_normal; 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /lencod/inc/fmo.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | *************************************************************************** 4 | * 5 | * \file fmo.h 6 | * 7 | * \brief 8 | * Support for Flexible Macroblock Ordering 9 | * 10 | * \date 11 | * 16 June 2002 12 | * 13 | * \author 14 | * Stephan Wenger stewe@cs.tu-berlin.de 15 | **************************************************************************/ 16 | 17 | #ifndef _FMO_H_ 18 | #define _FMO_H_ 19 | 20 | extern int FmoInit (VideoParameters * p_Vid, pic_parameter_set_rbsp_t * pps, seq_parameter_set_rbsp_t * sps); 21 | extern void FmoUninit (VideoParameters *p_Vid); 22 | extern int FmoFinit (seq_parameter_set_rbsp_t * sps); 23 | extern int FmoMB2SliceGroup (VideoParameters *p_Vid, int mb); 24 | extern int FmoGetFirstMBOfSliceGroup (VideoParameters *p_Vid, int SliceGroupID); 25 | extern int FmoGetFirstMacroblockInSlice (VideoParameters *p_Vid, int SliceGroup); 26 | extern int FmoGetNextMBNr (VideoParameters *p_Vid, int CurrentMbNr); 27 | extern int FmoGetPreviousMBNr (VideoParameters *p_Vid, int CurrentMbNr); 28 | extern int FmoGetLastCodedMBOfSliceGroup (VideoParameters *p_Vid, int SliceGroupID); 29 | extern int FmoStartPicture (VideoParameters *p_Vid); 30 | extern int FmoEndPicture (void); 31 | extern int FmoSliceGroupCompletelyCoded (VideoParameters *p_Vid, int SliceGroupID); 32 | extern void FmoSetLastMacroblockInSlice (VideoParameters *p_Vid, int mb); 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /lencod/inc/ratectl.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | *************************************************************************** 4 | * \file 5 | * ratectl.h 6 | * 7 | * \author 8 | * Zhengguo LI 9 | * Athanasios Leontaris 10 | * 11 | * \date 12 | * 14 Jan 2003 13 | * 14 | * \brief 15 | * Headerfile for rate control 16 | ************************************************************************** 17 | */ 18 | 19 | #ifndef _RATE_CTL_H_ 20 | #define _RATE_CTL_H_ 21 | 22 | #include "global.h" 23 | #include "rc_quadratic.h" 24 | 25 | 26 | // generic functions 27 | extern int Qstep2QP ( double Qstep, int qp_offset ); 28 | extern double QP2Qstep ( int QP ); 29 | extern int ComputeMBMAD ( int diff[16][16] ); 30 | extern double ComputeFrameMAD ( VideoParameters *p_Vid ); 31 | extern void rc_store_mad ( Macroblock *currMB ); 32 | 33 | // rate control functions 34 | // init/copy 35 | extern void rc_alloc_generic ( VideoParameters *p_Vid, RCGeneric **p_quad ); 36 | extern void rc_free_generic ( RCGeneric **p_quad ); 37 | extern void rc_copy_generic ( VideoParameters *p_Vid, RCGeneric *dst, RCGeneric *src ); 38 | extern void rc_init_gop_params ( VideoParameters *p_Vid, InputParameters *p_Inp ); 39 | extern void rc_init_frame ( VideoParameters *p_Vid, InputParameters *p_Inp); 40 | extern void rc_init_sequence ( VideoParameters *p_Vid, InputParameters *p_Inp); 41 | extern void rc_store_slice_header_bits ( VideoParameters *p_Vid, InputParameters *p_Inp, int len); 42 | 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /lencod/inc/rdopt_coding_state.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | *************************************************************************** 4 | * \file 5 | * rdopt_coding_state.h 6 | * 7 | * \author 8 | * Heiko Schwarz 9 | * 10 | * \date 11 | * 17. April 2001 12 | * 13 | * \brief 14 | * Headerfile for storing/restoring coding state 15 | * (for rd-optimized mode decision) 16 | ************************************************************************** 17 | */ 18 | 19 | #ifndef _RD_OPT_CS_H_ 20 | #define _RD_OPT_CS_H_ 21 | 22 | struct coding_state { 23 | 24 | // important variables of data partition array 25 | int no_part; 26 | Bitstream *bitstream; 27 | EncodingEnvironment *encenv; 28 | 29 | // contexts for binary arithmetic coding 30 | MotionInfoContexts *mot_ctx; 31 | TextureInfoContexts *tex_ctx; 32 | 33 | // bit counter 34 | BitCounter bits; 35 | 36 | // elements of current macroblock 37 | short mvd[2][BLOCK_MULTIPLE][BLOCK_MULTIPLE][2]; 38 | int64 cbp_bits[3]; 39 | int64 *cbp_bits_8x8; 40 | }; 41 | 42 | typedef struct coding_state CSobj; 43 | 44 | extern void delete_coding_state (CSobj *); //!< delete structure 45 | extern CSobj *create_coding_state (InputParameters *p_Inp); //!< create structure 46 | 47 | extern void init_coding_state_methods(Slice *currSlice); //!< Init methods given entropy coding 48 | 49 | extern void store_coding_state_cavlc (Macroblock *currMB, CSobj *cs); 50 | extern void reset_coding_state_cavlc (Macroblock *currMB, CSobj *cs); 51 | 52 | #endif 53 | 54 | -------------------------------------------------------------------------------- /lcommon/inc/io_image.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************ 3 | * \file io_image.h 4 | * 5 | * \brief 6 | * Image I/O 7 | * 8 | * \author 9 | * - Alexis Michael Tourapis 10 | * 11 | ************************************************************************ 12 | */ 13 | 14 | #ifndef _IO_IMAGE_H_ 15 | #define _IO_IMAGE_H_ 16 | 17 | #include "defines.h" 18 | #include "frame.h" 19 | 20 | typedef struct image_data 21 | { 22 | FrameFormat format; //!< image format 23 | // Standard data 24 | imgpel **frm_data[MAX_PLANE]; //!< Frame Data 25 | imgpel **top_data[MAX_PLANE]; //!< pointers to top field data 26 | imgpel **bot_data[MAX_PLANE]; //!< pointers to bottom field data 27 | 28 | imgpel **frm_data_buf[2][MAX_PLANE]; //!< Frame Data 29 | imgpel **top_data_buf[2][MAX_PLANE]; //!< pointers to top field data 30 | imgpel **bot_data_buf[2][MAX_PLANE]; //!< pointers to bottom field data 31 | 32 | //! Optional data (could also add uint8 data in case imgpel is of type uint16) 33 | //! These can be useful for enabling input/conversion of content of different types 34 | //! while keeping optimal processing size. 35 | uint16 **frm_uint16[MAX_PLANE]; //!< optional frame Data for uint16 36 | uint16 **top_uint16[MAX_PLANE]; //!< optional pointers to top field data 37 | uint16 **bot_uint16[MAX_PLANE]; //!< optional pointers to bottom field data 38 | 39 | int frm_stride[MAX_PLANE]; 40 | int top_stride[MAX_PLANE]; 41 | int bot_stride[MAX_PLANE]; 42 | } ImageData; 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /lencod/inc/me_fullfast.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file 5 | * me_fullfast.h 6 | * 7 | * \author 8 | * Alexis Michael Tourapis 9 | * 10 | * \date 11 | * 9 September 2006 12 | * 13 | * \brief 14 | * Headerfile for Fast Full Search motion estimation 15 | ************************************************************************** 16 | */ 17 | 18 | 19 | #ifndef _ME_FULLFAST_H_ 20 | #define _ME_FULLFAST_H_ 21 | typedef struct me_full_fast 22 | { 23 | int **search_setup_done; //!< flag if all block SAD's have been calculated yet 24 | MotionVector **search_center; //!< absolute search center for fast full motion search 25 | MotionVector **search_center_padded; //!< absolute search center for fast full motion search 26 | int **pos_00; //!< position of (0,0) vector 27 | distpel *****BlockSAD; //!< SAD for all blocksize, ref. frames and motion vectors 28 | int **max_search_range; 29 | } MEFullFast; 30 | 31 | extern distblk fast_full_search_motion_estimation ( Macroblock *, MotionVector *, MEBlock *, distblk, int ); 32 | extern void initialize_fast_full_search ( VideoParameters *, InputParameters * ); 33 | extern void reset_fast_full_search ( VideoParameters * ); 34 | extern void clear_fast_full_search ( VideoParameters * ); 35 | extern void setup_fast_full_search ( Macroblock *, MEBlock *, int ); 36 | extern void update_full_search_large_blocks ( MEFullFast *, int, int, int ); 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /lcommon/inc/mb_access.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************* 4 | * \file mb_access.h 5 | * 6 | * \brief 7 | * Functions for macroblock neighborhoods 8 | * 9 | * \author 10 | * Main contributors (see contributors.h for copyright, address and affiliation details) 11 | * - Karsten Suehring 12 | * - Alexis Michael Tourapis 13 | ************************************************************************************* 14 | */ 15 | 16 | #ifndef _MB_ACCESS_H_ 17 | #define _MB_ACCESS_H_ 18 | 19 | extern void CheckAvailabilityOfNeighbors(Macroblock *currMB); 20 | extern void CheckAvailabilityOfNeighborsMBAFF(Macroblock *currMB); 21 | extern void CheckAvailabilityOfNeighborsNormal(Macroblock *currMB); 22 | 23 | extern void getAffNeighbour (Macroblock *currMB, int xN, int yN, int mb_size[2], PixelPos *pix); 24 | extern void getNonAffNeighbour (Macroblock *currMB, int xN, int yN, int mb_size[2], PixelPos *pix); 25 | extern void get4x4Neighbour (Macroblock *currMB, int xN, int yN, int mb_size[2], PixelPos *pix); 26 | extern void get4x4NeighbourBase (Macroblock *currMB, int block_x, int block_y, int mb_size[2], PixelPos *pix); 27 | extern Boolean mb_is_available (int mbAddr, Macroblock *currMB); 28 | extern void get_mb_pos (VideoParameters *p_Vid, int mb_addr, int mb_size[2], short *x, short *y); 29 | extern void get_mb_block_pos_normal (BlockPos *PicPos, int mb_addr, short *x, short *y); 30 | extern void get_mb_block_pos_mbaff (BlockPos *PicPos, int mb_addr, short *x, short *y); 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /lcommon/src/win32.c: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************* 4 | * \file win32.c 5 | * 6 | * \brief 7 | * Platform dependent code 8 | * 9 | * \author 10 | * Main contributors (see contributors.h for copyright, address and affiliation details) 11 | * - Karsten Suehring 12 | ************************************************************************************* 13 | */ 14 | 15 | #include "global.h" 16 | 17 | 18 | #ifdef _WIN32 19 | 20 | static LARGE_INTEGER freq; 21 | 22 | void gettime(TIME_T* time) 23 | { 24 | #ifndef TIMING_DISABLE 25 | QueryPerformanceCounter(time); 26 | #endif 27 | } 28 | 29 | int64 timediff(TIME_T* start, TIME_T* end) 30 | { 31 | #ifndef TIMING_DISABLE 32 | return (int64)((end->QuadPart - start->QuadPart)); 33 | #else 34 | return 0; 35 | #endif 36 | } 37 | 38 | void init_time(void) 39 | { 40 | QueryPerformanceFrequency(&freq); 41 | } 42 | 43 | int64 timenorm(int64 cur_time) 44 | { 45 | #ifndef TIMING_DISABLE 46 | return (int64)(cur_time * 1000 /(freq.QuadPart)); 47 | #else 48 | return 1; 49 | #endif 50 | } 51 | 52 | #else 53 | 54 | static struct timezone tz; 55 | 56 | void gettime(TIME_T* time) 57 | { 58 | gettimeofday(time, &tz); 59 | } 60 | 61 | void init_time(void) 62 | { 63 | } 64 | 65 | int64 timediff(TIME_T* start, TIME_T* end) 66 | { 67 | int t1, t2; 68 | 69 | t1 = end->tv_sec - start->tv_sec; 70 | t2 = end->tv_usec - start->tv_usec; 71 | return (int64) t2 + (int64) t1 * (int64) 1000000; 72 | } 73 | 74 | int64 timenorm(int64 cur_time) 75 | { 76 | return (int64)(cur_time / (int64) 1000); 77 | } 78 | #endif 79 | -------------------------------------------------------------------------------- /lencod/inc/slice.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * slice.h 5 | * 6 | * \date 7 | * 16 July 2008 8 | * 9 | * \brief 10 | * Headerfile for slice-related functions 11 | * \author 12 | * Main contributors (see contributors.h for copyright, address and affiliation details) 13 | * - Athanasios Leontaris 14 | * - Karsten Suehring 15 | * - Alexis Michael Tourapis 16 | 17 | ************************************************************************** 18 | */ 19 | 20 | #ifndef _SLICE_H_ 21 | #define _SLICE_H_ 22 | 23 | #include "global.h" 24 | #include "mbuffer.h" 25 | #include "rdopt_coding_state.h" 26 | 27 | static const int QP2QUANT[40]= 28 | { 29 | 1, 1, 1, 1, 2, 2, 2, 2, 30 | 3, 3, 3, 4, 4, 4, 5, 6, 31 | 6, 7, 8, 9,10,11,13,14, 32 | 16,18,20,23,25,29,32,36, 33 | 40,45,51,57,64,72,81,91 34 | }; 35 | 36 | 37 | extern int encode_one_slice ( VideoParameters *p_Vid, int SliceGroupId, int TotalCodedMBs ); 38 | extern int encode_one_slice_MBAFF ( VideoParameters *p_Vid, int SliceGroupId, int TotalCodedMBs ); 39 | extern void init_slice ( VideoParameters *p_Vid, Slice **currSlice, int start_mb_addr ); 40 | extern void init_slice_lite ( VideoParameters *p_Vid, Slice **currSlice, int start_mb_addr ); 41 | extern void free_slice_list ( Picture *currPic ); 42 | 43 | extern void SetLagrangianMultipliersOn (Slice *currSlice); 44 | extern void SetLagrangianMultipliersOff(Slice *currSlice); 45 | extern void free_slice (Slice *currSlice); 46 | 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /lencod/inc/wp_lms.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * wp_lms.h 5 | * 6 | * \author 7 | * Alexis Michael Tourapis 8 | * 9 | * \date 10 | * 22. February 2008 11 | * 12 | * \brief 13 | * Headerfile for weighted prediction support using LMS 14 | ************************************************************************** 15 | */ 16 | 17 | #ifndef _WP_LMS_H_ 18 | #define _WP_LMS_H_ 19 | 20 | extern void EstimateWPPSliceAlg1(Slice *currSlice, int offset); 21 | extern void EstimateWPBSliceAlg1(Slice *currSlice); 22 | extern int TestWPPSliceAlg1 (Slice *currSlice, int offset); 23 | extern int TestWPBSliceAlg1 (Slice *currSlice, int method); 24 | extern void ComputeExplicitWPParamsLMS(Slice *currSlice, 25 | int select_offset, 26 | int start_mb, 27 | int end_mb, 28 | short default_weight[3], 29 | short weight[6][MAX_REFERENCE_PICTURES][3], 30 | short offset[6][MAX_REFERENCE_PICTURES][3]); 31 | extern void ComputeExplicitWPParamsJNT(Slice *currSlice, 32 | int start_mb, 33 | int end_mb, 34 | short default_weight[3], 35 | short weight[6][MAX_REFERENCE_PICTURES][3], 36 | short offset[6][MAX_REFERENCE_PICTURES][3]); 37 | 38 | 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /ldecod/inc/image.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file image.h 5 | * 6 | * \brief 7 | * prototypes for image.c 8 | * 9 | ************************************************************************ 10 | */ 11 | 12 | #ifndef _IMAGE_H_ 13 | #define _IMAGE_H_ 14 | 15 | #include "mbuffer.h" 16 | 17 | extern void calculate_frame_no(VideoParameters *p_Vid, StorablePicture *p); 18 | extern void find_snr (VideoParameters *p_Vid, StorablePicture *p, int *p_ref); 19 | extern int picture_order ( Slice *pSlice ); 20 | 21 | extern void decode_one_slice (Slice *currSlice); 22 | extern int read_new_slice (Slice *currSlice); 23 | extern void exit_picture (VideoParameters *p_Vid, StorablePicture **dec_picture); 24 | extern int decode_one_frame (DecoderParams *pDecoder); 25 | 26 | extern int is_new_picture(StorablePicture *dec_picture, Slice *currSlice, OldSliceParams *p_old_slice); 27 | extern void init_old_slice(OldSliceParams *p_old_slice); 28 | // For 4:4:4 independent mode 29 | extern void copy_dec_picture_JV (VideoParameters *p_Vid, StorablePicture *dst, StorablePicture *src ); 30 | 31 | extern void frame_postprocessing(VideoParameters *p_Vid); 32 | extern void field_postprocessing(VideoParameters *p_Vid); 33 | 34 | #if (MVC_EXTENSION_ENABLE) 35 | extern int GetViewIdx(VideoParameters *p_Vid, int iVOIdx); 36 | extern int GetVOIdx(VideoParameters *p_Vid, int iViewId); 37 | extern int get_maxViewIdx(VideoParameters *p_Vid, int view_id, int anchor_pic_flag, int listidx); 38 | #endif 39 | 40 | extern void init_slice(VideoParameters *p_Vid, Slice *currSlice); 41 | extern void decode_slice(Slice *currSlice, int current_header); 42 | 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /lencod/inc/wp.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * wp.h 5 | * 6 | * \author 7 | * Alexis Michael Tourapis 8 | * 9 | * \date 10 | * 22. February 2008 11 | * 12 | * \brief 13 | * Headerfile for weighted prediction support 14 | ************************************************************************** 15 | */ 16 | 17 | #ifndef _WP_H_ 18 | #define _WP_H_ 19 | 20 | #include "wp_lms.h" 21 | #include "wp_mcprec.h" 22 | #include "wp_mciter.h" 23 | #include "wp_random.h" 24 | #include "wp_periodic.h" 25 | 26 | #define DEBUG_WP 0 27 | 28 | void InitWP (VideoParameters *p_Vid, InputParameters *p_Inp, int force_wp_method); 29 | void ResetWP (VideoParameters *p_Vid, InputParameters *p_Inp); 30 | 31 | extern void EstimateWPBSliceAlg0 (Slice *currSlice); 32 | extern void EstimateWPPSliceAlg0 (Slice *currSlice, int offset); 33 | extern int TestWPPSliceAlg0 (Slice *currSlice, int offset); 34 | extern int TestWPBSliceAlg0 (Slice *currSlice, int method); 35 | extern double ComputeImgSum (imgpel **CurrentImage, int height, int width); 36 | extern void ComputeImgSumBlockBased(imgpel **CurrentImage, int height_in_blk, int width_in_blk, int blk_size_y, int blk_size_x, int start_blk, int end_blk, double *dc); 37 | extern int64 ComputeSumBlockBased (imgpel **CurrentImage, int height_in_blk, int width_in_blk, int blk_size_y, int blk_size_x, int start_blk, int end_blk); 38 | 39 | extern void ComputeImplicitWeights (Slice *currSlice, 40 | short default_weight[3], 41 | short im_weight[6][MAX_REFERENCE_PICTURES][MAX_REFERENCE_PICTURES][3]); 42 | 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /lencod/inc/pred_struct.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * pred_struct.h 5 | * 6 | * \author 7 | * Athanasios Leontaris 8 | * 9 | * \date 10 | * June 8, 2009 11 | * 12 | * \brief 13 | * Header file for prediction structure function headers 14 | ************************************************************************** 15 | */ 16 | 17 | #ifndef _PRED_STRUCT_H_ 18 | #define _PRED_STRUCT_H_ 19 | 20 | #include "global.h" 21 | #include "pred_struct_types.h" 22 | #include "explicit_seq.h" 23 | 24 | extern void get_poc_type_zero( VideoParameters *p_Vid, InputParameters *p_Inp, FrameUnitStruct *p_frm_struct ); 25 | extern void get_poc_type_one( VideoParameters *p_Vid, InputParameters *p_Inp, FrameUnitStruct *p_frm_struct ); 26 | extern void init_poc(VideoParameters *p_Vid); 27 | extern SeqStructure * init_seq_structure( VideoParameters *p_Vid, InputParameters *p_Inp, int *memory_size ); 28 | extern void free_seq_structure( SeqStructure *p_seq_struct ); 29 | extern void populate_frm_struct( VideoParameters *p_Vid, InputParameters *p_Inp, SeqStructure *p_seq_struct, int num_to_populate, int init_frames_to_code ); 30 | extern void populate_frame_explicit( ExpFrameInfo *info, InputParameters *p_Inp, FrameUnitStruct *p_frm_struct, int num_slices ); 31 | extern void populate_frame_slice_type( InputParameters *p_Inp, FrameUnitStruct *p_frm_struct, int slice_type, int num_slices ); 32 | extern void populate_reg_pic( InputParameters *p_Inp, PicStructure *p_pic, FrameUnitStruct *p_frm_struct, int num_slices, int is_bot_fld ); 33 | extern void populate_frm_struct_mvc( VideoParameters *p_Vid, InputParameters *p_Inp, SeqStructure *p_seq_struct, int start, int end ); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /lcommon/src/nalucommon.c: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file nalucommon.c 5 | * 6 | * \brief 7 | * Common NALU support functions 8 | * 9 | * \author 10 | * Main contributors (see contributors.h for copyright, address and affiliation details) 11 | * - Stephan Wenger 12 | ************************************************************************ 13 | */ 14 | 15 | #include "global.h" 16 | #include "nalucommon.h" 17 | #include "memalloc.h" 18 | 19 | /*! 20 | ************************************************************************************* 21 | * \brief 22 | * Allocates memory for a NALU 23 | * 24 | * \param buffersize 25 | * size of NALU buffer 26 | * 27 | * \return 28 | * pointer to a NALU 29 | ************************************************************************************* 30 | */ 31 | NALU_t *AllocNALU(int buffersize) 32 | { 33 | NALU_t *n; 34 | 35 | if ((n = (NALU_t*)calloc (1, sizeof (NALU_t))) == NULL) 36 | no_mem_exit ("AllocNALU: n"); 37 | 38 | n->max_size=buffersize; 39 | if ((n->buf = (byte*)calloc (buffersize, sizeof (byte))) == NULL) 40 | { 41 | free (n); 42 | no_mem_exit ("AllocNALU: n->buf"); 43 | } 44 | 45 | return n; 46 | } 47 | 48 | 49 | /*! 50 | ************************************************************************************* 51 | * \brief 52 | * Frees a NALU 53 | * 54 | * \param n 55 | * NALU to be freed 56 | * 57 | ************************************************************************************* 58 | */ 59 | void FreeNALU(NALU_t *n) 60 | { 61 | if (n != NULL) 62 | { 63 | if (n->buf != NULL) 64 | { 65 | free(n->buf); 66 | n->buf=NULL; 67 | } 68 | free (n); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /lcommon/src/blk_prediction.c: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************************* 3 | * \file blk_prediction.c 4 | * 5 | * \brief 6 | * Block Prediction related functions 7 | * 8 | * \author 9 | * Main contributors (see contributors.h for copyright, address and affiliation details) 10 | * - Alexis Michael Tourapis 11 | * 12 | ************************************************************************************* 13 | */ 14 | 15 | #include "contributors.h" 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #include "block.h" 23 | #include "global.h" 24 | 25 | #include "macroblock.h" 26 | #include "mc_prediction.h" 27 | #include "image.h" 28 | #include "mb_access.h" 29 | 30 | void compute_residue (imgpel **curImg, imgpel **mpr, int **mb_rres, int mb_x, int opix_x, int width, int height) 31 | { 32 | imgpel *imgOrg, *imgPred; 33 | int *m7; 34 | int i, j; 35 | 36 | for (j = 0; j < height; j++) 37 | { 38 | imgOrg = &curImg[j][opix_x]; 39 | imgPred = &mpr[j][mb_x]; 40 | m7 = &mb_rres[j][mb_x]; 41 | for (i = 0; i < width; i++) 42 | { 43 | *m7++ = *imgOrg++ - *imgPred++; 44 | } 45 | } 46 | } 47 | 48 | void sample_reconstruct (imgpel **curImg, imgpel **mpr, int **mb_rres, int mb_x, int opix_x, int width, int height, int max_imgpel_value, int dq_bits) 49 | { 50 | imgpel *imgOrg, *imgPred; 51 | int *m7; 52 | int i, j; 53 | 54 | for (j = 0; j < height; j++) 55 | { 56 | imgOrg = &curImg[j][opix_x]; 57 | imgPred = &mpr[j][mb_x]; 58 | m7 = &mb_rres[j][mb_x]; 59 | for (i=0;i 8 | * Alexis Michael Tourapis 9 | * 10 | * \date 11 | * 4. October 2006 12 | * 13 | * \brief 14 | * Headerfile for luma interpolation functions 15 | ************************************************************************** 16 | */ 17 | 18 | #ifndef _IMG_LUMA_H_ 19 | #define _IMG_LUMA_H_ 20 | 21 | static const int ONE_FOURTH_TAP[2][3] = 22 | { 23 | {20, -5, 1}, // AVC Interpolation taps 24 | {20,-4, 0}, // Experimental - not valid 25 | }; 26 | 27 | extern void getSubImagesLuma ( VideoParameters *p_Vid, StorablePicture *s ); 28 | /* 29 | extern void getSubImageInteger ( StorablePicture *s, imgpel **dstImg, imgpel **srcImg); 30 | extern void getSubImageInteger_s ( StorablePicture *s, imgpel **dstImg, imgpel **srcImg); 31 | extern void getHorSubImageSixTap ( VideoParameters *p_Vid, StorablePicture *s, imgpel **dst_imgY, imgpel **ref_imgY); 32 | extern void getVerSubImageSixTap ( VideoParameters *p_Vid, StorablePicture *s, imgpel **dst_imgY, imgpel **ref_imgY); 33 | extern void getVerSubImageSixTapTmp( VideoParameters *p_Vid, StorablePicture *s, imgpel **dst_imgY); 34 | extern void getSubImageBiLinear ( StorablePicture *s, imgpel **dstImg, imgpel **srcImgL, imgpel **srcImgR); 35 | extern void getHorSubImageBiLinear ( StorablePicture *s, imgpel **dstImg, imgpel **srcImgL, imgpel **srcImgR); 36 | extern void getVerSubImageBiLinear ( StorablePicture *s, imgpel **dstImg, imgpel **srcImgT, imgpel **srcImgB); 37 | extern void getDiagSubImageBiLinear( StorablePicture *s, imgpel **dstImg, imgpel **srcImgT, imgpel **srcImgB); 38 | */ 39 | #endif // _IMG_LUMA_H_ 40 | -------------------------------------------------------------------------------- /ldecod/inc/erc_do.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file erc_do.h 5 | * 6 | * \brief 7 | * Header for the I & P frame error concealment common functions 8 | * 9 | * \author 10 | * - Viktor Varsa 11 | * - Ye-Kui Wang 12 | * 13 | ************************************************************************ 14 | */ 15 | 16 | #ifndef _ERC_DO_H_ 17 | #define _ERC_DO_H_ 18 | 19 | 20 | #include "erc_api.h" 21 | 22 | void ercPixConcealIMB (VideoParameters *p_Vid, imgpel *currFrame, int row, int column, int predBlocks[], int frameWidth, int mbWidthInBlocks); 23 | 24 | int ercCollect8PredBlocks( int predBlocks[], int currRow, int currColumn, char *condition, 25 | int maxRow, int maxColumn, int step, byte fNoCornerNeigh ); 26 | int ercCollectColumnBlocks( int predBlocks[], int currRow, int currColumn, char *condition, int maxRow, int maxColumn, int step ); 27 | 28 | #define isSplitted(object_list,currMBNum) \ 29 | ((object_list+((currMBNum)<<2))->regionMode >= REGMODE_SPLITTED) 30 | 31 | /* this can be used as isBlock(...,INTRA) or isBlock(...,INTER_COPY) */ 32 | #define isBlock(object_list,currMBNum,comp,regMode) \ 33 | (isSplitted(object_list,currMBNum) ? \ 34 | ((object_list+((currMBNum)<<2)+(comp))->regionMode == REGMODE_##regMode##_8x8) : \ 35 | ((object_list+((currMBNum)<<2))->regionMode == REGMODE_##regMode)) 36 | 37 | /* this can be used as getParam(...,mv) or getParam(...,xMin) or getParam(...,yMin) */ 38 | #define getParam(object_list,currMBNum,comp,param) \ 39 | (isSplitted(object_list,currMBNum) ? \ 40 | ((object_list+((currMBNum)<<2)+(comp))->param) : \ 41 | ((object_list+((currMBNum)<<2))->param)) 42 | 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /lencod/inc/list_reorder.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * list_reorder.h 5 | * 6 | * \date 7 | * 25 Feb 2009 8 | * 9 | * \brief 10 | * Headerfile for slice-related functions 11 | * \author 12 | * Main contributors (see contributors.h for copyright, address and affiliation details) 13 | * - Athanasios Leontaris 14 | * - Karsten Suehring 15 | * - Alexis Michael Tourapis 16 | ************************************************************************** 17 | */ 18 | 19 | #ifndef _LIST_REORDER_H_ 20 | #define _LIST_REORDER_H_ 21 | 22 | #include "global.h" 23 | #include "mbuffer.h" 24 | 25 | extern void init_ref_pic_list_reordering( Slice *currSlice, int refReorderMethod, int useDistortionReordering); 26 | extern void reorder_lists ( Slice *currSlice ); 27 | extern void wp_mcprec_reorder_lists ( Slice *currSlice ); 28 | 29 | 30 | extern void poc_ref_pic_reorder_frame_default( Slice *currSlice, unsigned num_ref_idx_lX_active, int list_no ); 31 | extern void poc_ref_pic_reorder_field ( Slice *currSlice, unsigned num_ref_idx_lX_active, int list_no ); 32 | extern void poc_ref_pic_reorder_field_enh ( Slice *currSlice, unsigned num_ref_idx_lX_active, int list_no ); 33 | 34 | extern void tlyr_ref_pic_reorder_frame_default ( Slice *currSlice, unsigned num_ref_idx_lX_active, int list_no ); 35 | extern void reorder_against_default_ref_pic_lists( Slice *currSlice, int cur_list ); 36 | extern void poc_ref_pic_reorder_frame_enh ( Slice *currSlice, unsigned num_ref_idx_lX_active, int list_no ); 37 | extern void mse_ref_pic_reorder_frame ( Slice *currSlice, unsigned num_ref_idx_lX_active, int list_no ); 38 | extern void set_default_ref_pic_lists( Slice *currSlice ); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /lencod/inc/wp_mcprec.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *************************************************************************** 3 | * \file 4 | * wp_mcprec.h 5 | * 6 | * \brief 7 | * Headerfile for Improved Motion Compensatation Precision Scheme using Weighted Prediction 8 | * \author 9 | * Main contributors (see contributors.h for copyright, address and affiliation details) 10 | * - Athanasios Leontaris 11 | * 12 | * \date 13 | * 16 July 2008 14 | * 15 | ************************************************************************** 16 | */ 17 | 18 | #ifndef _WP_MCPREC_H_ 19 | #define _WP_MCPREC_H_ 20 | 21 | typedef struct 22 | { 23 | int PicNum; // PicNum/FrameNum 24 | int POCNum; // POC 25 | } 26 | WeightedPredRefX; 27 | 28 | typedef struct 29 | { 30 | int algorithm; 31 | } 32 | WPXPass; 33 | 34 | typedef struct wpx_object 35 | { 36 | int num_wp_ref_list[2]; // num of elements in each of the above matrices [LIST] 37 | WeightedPredRefX *wp_ref_list[2]; // structure with reordering and WP information for ref frames [LIST] 38 | WPXPass *curr_wp_rd_pass; 39 | WPXPass wp_rd_passes[3]; // frame_picture [0...4] (MultiRefWeightedPred == 2) 40 | } 41 | WPXObject; 42 | 43 | extern void wpxInitWPXObject( VideoParameters *p_Vid ); 44 | extern void wpxFreeWPXObject( VideoParameters *p_Vid ); 45 | extern void wpxInitWPXPasses( VideoParameters *p_Vid, InputParameters *p_Inp ); 46 | extern void wpxModifyRefPicList( Slice *currSlice ); 47 | // Note that at some point, InputParameters p_Inp contents should be copied into VideoParameters *p_Vid. 48 | // This would eliminate need of having to use both structures 49 | extern int wpxDetermineWP( Slice *currSlice, int clist, int n ); 50 | extern void wpxAdaptRefNum( Slice *currSlice ); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /ldecod/inc/erc_globals.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file erc_globals.h 5 | * 6 | * \brief 7 | * global header file for error concealment module 8 | * 9 | * \author 10 | * - Viktor Varsa 11 | * - Ye-Kui Wang 12 | ************************************************************************ 13 | */ 14 | 15 | #ifndef _ERC_GLOBALS_H_ 16 | #define _ERC_GLOBALS_H_ 17 | 18 | #include "defines.h" 19 | 20 | /* "block" means an 8x8 pixel area */ 21 | 22 | /* Region modes */ 23 | #define REGMODE_INTER_COPY 0 //!< Copy region 24 | #define REGMODE_INTER_PRED 1 //!< Inter region with motion vectors 25 | #define REGMODE_INTRA 2 //!< Intra region 26 | #define REGMODE_SPLITTED 3 //!< Any region mode higher than this indicates that the region 27 | //!< is splitted which means 8x8 block 28 | #define REGMODE_INTER_COPY_8x8 4 29 | #define REGMODE_INTER_PRED_8x8 5 30 | #define REGMODE_INTRA_8x8 6 31 | 32 | //! YUV pixel domain image arrays for a video frame 33 | typedef struct frame_s 34 | { 35 | VideoParameters *p_Vid; 36 | imgpel *yptr; 37 | imgpel *uptr; 38 | imgpel *vptr; 39 | } frame; 40 | 41 | //! region structure stores information about a region that is needed for concealment 42 | typedef struct object_buffer 43 | { 44 | byte regionMode; //!< region mode as above 45 | int xMin; //!< X coordinate of the pixel position of the top-left corner of the region 46 | int yMin; //!< Y coordinate of the pixel position of the top-left corner of the region 47 | int mv[3]; //!< motion vectors in 1/4 pixel units: mvx = mv[0], mvy = mv[1], 48 | //!< and ref_frame = mv[2] 49 | } objectBuffer_t; 50 | 51 | #endif 52 | 53 | -------------------------------------------------------------------------------- /lencod/inc/me_epzs.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file 5 | * me_epzs.h 6 | * 7 | * \author 8 | * Alexis Michael Tourapis 9 | * 10 | * \date 11 | * 11. August 2006 12 | * 13 | * \brief 14 | * Headerfile for EPZS motion estimation 15 | ************************************************************************** 16 | */ 17 | 18 | 19 | #ifndef _ME_EPZS_H_ 20 | #define _ME_EPZS_H_ 21 | #include "me_epzs_common.h" 22 | 23 | static const int next_start_pos[5][5] = 24 | { 25 | {0, 8, 5, 6, 7}, 26 | {8, 0, 5, 8, 8}, 27 | {5, 5, 0, 6, 5}, 28 | {6, 6, 6, 0, 7}, 29 | {7, 8, 7, 7, 0} 30 | }; 31 | 32 | static const int next_end_pos[5][5] = 33 | { 34 | {0, 10, 7, 8, 9}, 35 | {10, 0, 6, 10, 9}, 36 | {7, 6, 0, 7, 7}, 37 | {8, 8, 7, 0, 8}, 38 | {9, 9, 9, 8, 0} 39 | }; 40 | 41 | static const MotionVector search_point_hp[10] = {{0,0},{-2,0}, {0,2}, {2,0}, {0,-2}, {-2,2}, {2,2}, {2,-2}, {-2,-2}, {-2,2}}; 42 | static const MotionVector search_point_qp[10] = {{0,0},{-1,0}, {0,1}, {1,0}, {0,-1}, {-1,1}, {1,1}, {1,-1}, {-1,-1}, {-1,1}}; 43 | 44 | // Functions 45 | extern distblk EPZS_motion_estimation (Macroblock *, MotionVector *, MEBlock *, distblk, int); 46 | extern distblk EPZS_subMB_motion_estimation (Macroblock *, MotionVector *, MEBlock *, distblk, int); 47 | extern distblk EPZS_sub_pel_motion_estimation (Macroblock *, MotionVector *, MEBlock *, distblk, int*); 48 | extern distblk EPZS_sub_pel_bipred_motion_estimation (Macroblock *, MEBlock *, int list, MotionVector *, MotionVector *, MotionVector *, MotionVector *, distblk, int *); 49 | extern distblk EPZS_bipred_motion_estimation (Macroblock *, int, MotionVector *, MotionVector *, MotionVector *, MotionVector *, MEBlock *, int, distblk, int); 50 | 51 | 52 | #endif 53 | 54 | -------------------------------------------------------------------------------- /lencod/inc/lln_mc_prediction.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************************* 3 | * \file lln_mc_prediction.h 4 | * 5 | * \brief 6 | * definitions for motion compensated prediction 7 | * 8 | * \author 9 | * Main contributors (see contributors.h for copyright, 10 | * address and affiliation details) 11 | * - Alexis Michael Tourapis 12 | * - Modified for use in hypothetical decoders at encoder 13 | * by Peshala V. Pahalawatta 14 | * 15 | ************************************************************************************* 16 | */ 17 | 18 | #ifndef _LLN_MC_PREDICTION_H_ 19 | #define _LLN_MC_PREDICTION_H_ 20 | 21 | #include "global.h" 22 | #include "mbuffer.h" 23 | 24 | 25 | extern void get_block_luma (Macroblock *currMB, int decoder, ColorPlane pl, StorablePicture *dec_picture, StorablePicture *list, int x_pos, int y_pos, int block_size_y, int block_size_x, imgpel block[MB_BLOCK_SIZE][MB_BLOCK_SIZE]); 26 | extern void get_block_chroma(Macroblock *currMb, int decoder, int uv, StorablePicture *dec_picture, StorablePicture *list, int x_pos, int y_pos, int block_size_x, int block_size_y, imgpel block[MB_BLOCK_SIZE][MB_BLOCK_SIZE]); 27 | 28 | //extern void intra_cr_decoding(Macroblock *currMB, int yuv, int smb); 29 | //extern void prepare_direct_params(Macroblock *currMB, StorablePicture *dec_picture, MotionVector *pmvl0, MotionVector *pmvl1,char *l0_rFrame, char *l1_rFrame); 30 | 31 | extern void perform_mc (Macroblock* currMB, int decoder, ColorPlane pl, StorablePicture *dec_picture, int pred_dir, int l0_mode, int l1_mode, PicMotionParams **mv_info, int i, int j, int block_size_x, int block_size_y, short bipred_me); 32 | extern void perform_mc_concealment(Macroblock* currMB, int decoder, ColorPlane pl, StorablePicture *dec_picture, int pred_dir, int l0_mode, int l1_mode, PicMotionParams **mv_info, int i, int j, int block_size_x, int block_size_y); 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /lencod/inc/mc_prediction.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file 5 | * mc_prediction.h 6 | * 7 | * \brief 8 | * motion compensation header 9 | * 10 | * \author 11 | * Main contributors (see contributors.h for copyright, 12 | * address and affiliation details) 13 | * - Alexis Michael Tourapis 14 | * 15 | ************************************************************************************* 16 | */ 17 | 18 | #ifndef _MC_PREDICTION_H_ 19 | #define _MC_PREDICTION_H_ 20 | #include "mbuffer.h" 21 | 22 | extern void luma_prediction ( Macroblock* currMB, int, int, int, int, int, int[2], char *, short ); 23 | extern void luma_prediction_bi ( Macroblock* currMB, int, int, int, int, int, int, short, short, int ); 24 | extern void chroma_prediction ( Macroblock* currMB, int, int, int, int, int, int, int, int, short, short, short ); 25 | extern void chroma_prediction_4x4 ( Macroblock* currMB, int, int, int, int, int, int, short, short, short); 26 | 27 | extern void rdo_low_intra_chroma_decision (Macroblock *currMB, int mb_available_up, int mb_available_left[2], int mb_available_up_left); 28 | extern void rdo_low_intra_chroma_decision_mbaff (Macroblock *currMB, int mb_available_up, int mb_available_left[2], int mb_available_up_left); 29 | extern void OneComponentChromaPrediction4x4_regenerate (Macroblock *currMB, imgpel* , int , int , MotionVector ** , StorablePicture *listX, int ); 30 | extern void OneComponentChromaPrediction4x4_retrieve (Macroblock *currMB, imgpel* , int , int , MotionVector ** , StorablePicture *listX, int ); 31 | 32 | extern void intra_chroma_prediction_mbaff(Macroblock *currMB, int*, int*, int*); 33 | extern void intra_chroma_prediction (Macroblock *currMB, int*, int*, int*); 34 | extern void IntraChromaPrediction4x4 (Macroblock* currMB, int uv, int block_x, int block_y); 35 | extern void get_difference_4x4(imgpel **src, imgpel **prd, short *diff, int pos_x, int block_x); 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /bin/explicit_seq.cfg: -------------------------------------------------------------------------------- 1 | Sequence { 2 | FrameCount : 19 3 | Frame 4 | { 5 | SeqNumber : 0 6 | SliceType : I 7 | IDRPicture : 1 8 | Reference : 1 9 | } 10 | Frame 11 | { 12 | SeqNumber : 2 13 | SliceType : P 14 | IDRPicture : 0 15 | Reference : 1 16 | } 17 | Frame 18 | { 19 | SeqNumber : 1 20 | SliceType : B 21 | IDRPicture : 0 22 | Reference : 0 23 | } 24 | Frame 25 | { 26 | SeqNumber : 4 27 | SliceType : P 28 | IDRPicture : 0 29 | Reference : 1 30 | } 31 | Frame 32 | { 33 | SeqNumber : 3 34 | SliceType : B 35 | IDRPicture : 0 36 | Reference : 0 37 | } 38 | Frame 39 | { 40 | SeqNumber : 6 41 | SliceType : P 42 | IDRPicture : 0 43 | Reference : 1 44 | } 45 | Frame 46 | { 47 | SeqNumber : 5 48 | SliceType : B 49 | IDRPicture : 0 50 | Reference : 0 51 | } 52 | Frame 53 | { 54 | SeqNumber : 8 55 | SliceType : P 56 | IDRPicture : 0 57 | Reference : 1 58 | } 59 | Frame 60 | { 61 | SeqNumber : 7 62 | SliceType : B 63 | IDRPicture : 0 64 | Reference : 0 65 | } 66 | Frame 67 | { 68 | SeqNumber : 10 69 | SliceType : P 70 | IDRPicture : 0 71 | Reference : 1 72 | } 73 | Frame 74 | { 75 | SeqNumber : 9 76 | SliceType : B 77 | IDRPicture : 0 78 | Reference : 0 79 | } 80 | Frame 81 | { 82 | SeqNumber : 12 83 | SliceType : P 84 | IDRPicture : 0 85 | Reference : 1 86 | } 87 | Frame 88 | { 89 | SeqNumber : 11 90 | SliceType : B 91 | IDRPicture : 0 92 | Reference : 0 93 | } 94 | Frame 95 | { 96 | SeqNumber : 14 97 | SliceType : P 98 | IDRPicture : 0 99 | Reference : 1 100 | } 101 | Frame 102 | { 103 | SeqNumber : 13 104 | SliceType : B 105 | IDRPicture : 0 106 | Reference : 0 107 | } 108 | Frame 109 | { 110 | SeqNumber : 16 111 | SliceType : P 112 | IDRPicture : 0 113 | Reference : 1 114 | } 115 | Frame 116 | { 117 | SeqNumber : 15 118 | SliceType : B 119 | IDRPicture : 0 120 | Reference : 0 121 | } 122 | Frame 123 | { 124 | SeqNumber : 18 125 | SliceType : P 126 | IDRPicture : 0 127 | Reference : 1 128 | } 129 | Frame 130 | { 131 | SeqNumber : 17 132 | SliceType : B 133 | IDRPicture : 0 134 | Reference : 0 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /lencod/inc/me_distortion_otf.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ****************************************************************************************** 3 | * \file 4 | * me_distortion_otf.h 5 | * 6 | * \brief 7 | * Headerfile for motion estimation distortion with subpel interpolation on-the-fly 8 | ****************************************************************************************** 9 | */ 10 | 11 | #ifndef _ME_DISTORTION_OTF_H_ 12 | #define _ME_DISTORTION_OTF_H_ 13 | 14 | // SAD functions 15 | extern distblk computeSAD_otf (StorablePicture *ref1, MEBlock*, distblk, MotionVector *); 16 | 17 | // Weighted Prediction SAD functions 18 | extern distblk computeSADWP_otf (StorablePicture *ref1, MEBlock*, distblk, MotionVector *); 19 | 20 | // SATD 21 | extern distblk computeSATD_otf (StorablePicture *ref1, MEBlock*, distblk, MotionVector *); 22 | extern distblk computeSATDWP_otf (StorablePicture *ref1, MEBlock*, distblk, MotionVector *); 23 | 24 | // SSE 25 | extern distblk computeSSE_otf (StorablePicture *ref1, MEBlock*, distblk, MotionVector *); 26 | extern distblk computeSSEWP_otf (StorablePicture *ref1, MEBlock*, distblk, MotionVector *); 27 | 28 | // Bipred SAD 29 | extern distblk computeBiPredSAD1_otf (StorablePicture *ref1, StorablePicture *ref2, MEBlock*, distblk, MotionVector *, MotionVector *); 30 | extern distblk computeBiPredSAD2_otf (StorablePicture *ref1, StorablePicture *ref2, MEBlock*, distblk, MotionVector *, MotionVector *); 31 | 32 | // Bipred SATD 33 | extern distblk computeBiPredSATD1_otf (StorablePicture *ref1, StorablePicture *ref2, MEBlock*, distblk, MotionVector *, MotionVector *); 34 | extern distblk computeBiPredSATD2_otf (StorablePicture *ref1, StorablePicture *ref2, MEBlock*, distblk, MotionVector *, MotionVector *); 35 | 36 | // Bipred SSE 37 | extern distblk computeBiPredSSE1_otf (StorablePicture *ref1, StorablePicture *ref2, MEBlock*, distblk, MotionVector *, MotionVector *); 38 | extern distblk computeBiPredSSE2_otf (StorablePicture *ref1, StorablePicture *ref2, MEBlock*, distblk, MotionVector *, MotionVector *); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /rtpdump/Makefile: -------------------------------------------------------------------------------- 1 | ### 2 | ### Makefile for H.264/AVC RTP dump tool 3 | ### 4 | ### generated for UNIX/LINUX environments 5 | ### by H. Schwarz, Limin Wang 6 | ### 7 | 8 | 9 | 10 | NAME= rtpdump 11 | 12 | ### include debug information: 1=yes, 0=no 13 | DBG?= 0 14 | ### enforce 32-bit build : 1=yes, 0=no 15 | M32?= 0 16 | 17 | DEPEND= dependencies 18 | 19 | BINDIR= ../bin 20 | INCDIR= . 21 | SRCDIR= . 22 | OBJDIR= obj 23 | 24 | 25 | LIBS= -lm 26 | CFLAGS+= -ffloat-store -fsigned-char 27 | FLAGS= $(CFLAGS) -Wall -I$(INCDIR) -D __USE_LARGEFILE64 -D _FILE_OFFSET_BITS=64 28 | 29 | ifeq ($(M32),1) 30 | FLAGS+=-m32 31 | endif 32 | 33 | ifeq ($(DBG),1) 34 | SUFFIX= .dbg 35 | FLAGS+= -g 36 | else 37 | SUFFIX= 38 | FLAGS+= -O2 39 | 40 | endif 41 | 42 | OBJSUF= .o$(SUFFIX) 43 | 44 | SRC= $(wildcard $(SRCDIR)/*.cpp) 45 | OBJ= $(SRC:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o$(SUFFIX)) 46 | BIN= $(BINDIR)/$(NAME)$(SUFFIX).exe 47 | 48 | .PHONY: default distclean clean tags depend 49 | 50 | default: messages objdir_mk depend bin 51 | 52 | messages: 53 | ifeq ($(M32),1) 54 | @echo 'Compiling with M32 support...' 55 | endif 56 | ifeq ($(DBG),1) 57 | @echo 'Compiling with Debug support...' 58 | endif 59 | 60 | clean: 61 | @echo remove all objects 62 | @rm -rf $(OBJDIR) 63 | 64 | distclean: clean 65 | @rm -f $(DEPEND) tags 66 | @rm -f $(BIN) 67 | 68 | tags: 69 | @echo update tag table 70 | @ctags *.h *.cpp 71 | 72 | bin: $(OBJ) 73 | @echo 74 | @echo 'creating binary "$(BIN)"' 75 | @$(CXX) $(FLAGS) -o $(BIN) $(OBJ) $(LIBS) 76 | @echo '... done' 77 | @echo 78 | 79 | depend: 80 | @echo 81 | @echo 'checking dependencies' 82 | @$(SHELL) -ec '$(CXX) $(FLAGS) -MM $(CFLAGS) -I$(INCDIR) $(SRC) \ 83 | | sed '\''s@\(.*\)\.o[ :]@$(OBJDIR)/\1.o$(SUFFIX):@g'\'' \ 84 | >$(DEPEND)' 85 | @echo 86 | 87 | $(OBJDIR)/%.o$(SUFFIX): $(SRCDIR)/%.cpp 88 | @echo 'compiling object file "$@" ...' 89 | @$(CC) -c -o $@ $(FLAGS) $< 90 | 91 | objdir_mk: 92 | @echo 'Creating $(OBJDIR) ...' 93 | @mkdir -p $(OBJDIR) 94 | 95 | -include $(DEPEND) 96 | 97 | -------------------------------------------------------------------------------- /rtp_loss/Makefile: -------------------------------------------------------------------------------- 1 | ### 2 | ### Makefile for H.264/AVC RTP loss tool 3 | ### 4 | ### generated for UNIX/LINUX environments 5 | ### by H. Schwarz, Limin Wang 6 | ### 7 | 8 | 9 | 10 | NAME= rtp_loss 11 | 12 | ### include debug information: 1=yes, 0=no 13 | DBG?= 0 14 | ### enforce 32-bit build : 1=yes, 0=no 15 | M32?= 0 16 | 17 | DEPEND= dependencies 18 | 19 | BINDIR= ../bin 20 | INCDIR= . 21 | SRCDIR= . 22 | OBJDIR= obj 23 | 24 | 25 | LIBS= -lm 26 | AFLAGS= 27 | CFLAGS+= -ffloat-store -fsigned-char 28 | FLAGS= $(CFLAGS) -Wall -I$(INCDIR) -D __USE_LARGEFILE64 -D _FILE_OFFSET_BITS=64 29 | 30 | ifeq ($(M32),1) 31 | FLAGS+=-m32 32 | endif 33 | 34 | ifeq ($(DBG),1) 35 | SUFFIX= .dbg 36 | FLAGS+= -g 37 | else 38 | SUFFIX= 39 | FLAGS+= -O2 40 | 41 | endif 42 | 43 | OBJSUF= .o$(SUFFIX) 44 | 45 | SRC= $(wildcard $(SRCDIR)/*.cpp) 46 | OBJ= $(SRC:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o$(SUFFIX)) 47 | BIN= $(BINDIR)/$(NAME)$(SUFFIX).exe 48 | 49 | .PHONY: default distclean clean tags depend 50 | 51 | default: messages objdir_mk depend bin 52 | 53 | messages: 54 | ifeq ($(M32),1) 55 | @echo 'Compiling with M32 support...' 56 | endif 57 | ifeq ($(DBG),1) 58 | @echo 'Compiling with Debug support...' 59 | endif 60 | 61 | clean: 62 | @echo remove all objects 63 | @rm -rf $(OBJDIR) 64 | 65 | distclean: clean 66 | @rm -f $(DEPEND) tags 67 | @rm -f $(BIN) 68 | 69 | tags: 70 | @echo update tag table 71 | @ctags *.h *.cpp 72 | 73 | bin: $(OBJ) 74 | @echo 75 | @echo 'creating binary "$(BIN)"' 76 | @$(CXX) $(FLAGS) -o $(BIN) $(OBJ) $(LIBS) 77 | @echo '... done' 78 | @echo 79 | 80 | depend: 81 | @echo 82 | @echo 'checking dependencies' 83 | @$(SHELL) -ec '$(CXX) $(FLAGS) -MM $(CFLAGS) -I$(INCDIR) $(SRC) \ 84 | | sed '\''s@\(.*\)\.o[ :]@$(OBJDIR)/\1.o$(SUFFIX):@g'\'' \ 85 | >$(DEPEND)' 86 | @echo 87 | 88 | $(OBJDIR)/%.o$(SUFFIX): $(SRCDIR)/%.cpp 89 | @echo 'compiling object file "$@" ...' 90 | @$(CC) -c -o $@ $(FLAGS) $< 91 | 92 | objdir_mk: 93 | @echo 'Creating $(OBJDIR) ...' 94 | @mkdir -p $(OBJDIR) 95 | 96 | -include $(DEPEND) 97 | 98 | -------------------------------------------------------------------------------- /lencod/src/quant4x4.c: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************* 4 | * \file quant4x4.c 5 | * 6 | * \brief 7 | * Quantization process for a 4x4 block 8 | * 9 | * \author 10 | * Main contributors (see contributors.h for copyright, address and affiliation details) 11 | * - Alexis Michael Tourapis 12 | * 13 | ************************************************************************************* 14 | */ 15 | 16 | #include "contributors.h" 17 | #include "global.h" 18 | #include "quant4x4.h" 19 | 20 | /*! 21 | ************************************************************************ 22 | * \brief 23 | * Quantization initialization function 24 | * 25 | ************************************************************************ 26 | */ 27 | void init_quant_4x4(Slice *currSlice) 28 | { 29 | VideoParameters *p_Vid = currSlice->p_Vid; 30 | InputParameters *p_Inp = currSlice->p_Inp; 31 | 32 | if (currSlice->UseRDOQuant == 1) 33 | { 34 | currSlice->quant_4x4 = quant_4x4_trellis; 35 | if (p_Inp->RDOQ_DC == 1) 36 | currSlice->quant_dc4x4 = quant_dc4x4_trellis; 37 | else 38 | currSlice->quant_dc4x4 = quant_dc4x4_normal; 39 | currSlice->quant_ac4x4 = quant_ac4x4_trellis; 40 | if (currSlice->symbol_mode == CAVLC) 41 | { 42 | currSlice->rdoq_4x4 = rdoq_4x4_CAVLC; 43 | currSlice->rdoq_dc = rdoq_dc_CAVLC; 44 | currSlice->rdoq_ac4x4 = rdoq_ac4x4_CAVLC; 45 | } 46 | else 47 | { 48 | currSlice->rdoq_4x4 = rdoq_4x4_CABAC; 49 | currSlice->rdoq_dc = rdoq_dc_CABAC; 50 | currSlice->rdoq_ac4x4 = rdoq_ac4x4_CABAC; 51 | } 52 | } 53 | else if (p_Vid->AdaptiveRounding) 54 | { 55 | currSlice->quant_4x4 = quant_4x4_around; 56 | currSlice->quant_dc4x4 = quant_dc4x4_normal; 57 | currSlice->quant_ac4x4 = quant_ac4x4_around; 58 | } 59 | else 60 | { 61 | currSlice->quant_4x4 = quant_4x4_normal; 62 | currSlice->quant_dc4x4 = quant_dc4x4_normal; 63 | currSlice->quant_ac4x4 = quant_ac4x4_normal; 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /ldecod/inc/rtp.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************* 4 | * \file rtp.h 5 | * 6 | * \brief 7 | * Prototypes for rtp.c 8 | ************************************************************************************* 9 | */ 10 | 11 | #ifndef _RTP_H_ 12 | #define _RTP_H_ 13 | 14 | #include "nalucommon.h" 15 | 16 | #define MAXRTPPAYLOADLEN (65536 - 40) //!< Maximum payload size of an RTP packet */ 17 | #define MAXRTPPACKETSIZE (65536 - 28) //!< Maximum size of an RTP packet incl. header */ 18 | #define H264PAYLOADTYPE 105 //!< RTP paylaod type fixed here for simplicity*/ 19 | #define H264SSRC 0x12345678 //!< SSRC, chosen to simplify debugging */ 20 | #define RTP_TR_TIMESTAMP_MULT 1000 //!< should be something like 27 Mhz / 29.97 Hz */ 21 | 22 | typedef struct 23 | { 24 | unsigned int v; //!< Version, 2 bits, MUST be 0x2 25 | unsigned int p; //!< Padding bit, Padding MUST NOT be used 26 | unsigned int x; //!< Extension, MUST be zero 27 | unsigned int cc; /*!< CSRC count, normally 0 in the absence 28 | of RTP mixers */ 29 | unsigned int m; //!< Marker bit 30 | unsigned int pt; //!< 7 bits, Payload Type, dynamically established 31 | uint16 seq; /*!< RTP sequence number, incremented by one for 32 | each sent packet */ 33 | unsigned int timestamp; //!< timestamp, 27 MHz for H.264 34 | unsigned int ssrc; //!< Synchronization Source, chosen randomly 35 | byte * payload; //!< the payload including payload headers 36 | unsigned int paylen; //!< length of payload in bytes 37 | byte * packet; //!< complete packet including header and payload 38 | unsigned int packlen; //!< length of packet, typically paylen+12 39 | } RTPpacket_t; 40 | 41 | void DumpRTPHeader (RTPpacket_t *p); 42 | int GetRTPNALU (VideoParameters *p_Vid, NALU_t *nalu, int BitStreamFile); 43 | void OpenRTPFile (char *fn, int *p_BitStreamFile); 44 | void CloseRTPFile(int *p_BitStreamFile); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /ldecod/src/dec_statistics.c: -------------------------------------------------------------------------------- 1 | /*! 2 | *********************************************************************** 3 | * \file 4 | * dec_statistics.c 5 | * \brief 6 | * Decoder statistics handling. 7 | * \author 8 | * Main contributors (see contributors.h for copyright, address and affiliation details) 9 | * - Alexis Michael Tourapis 10 | *********************************************************************** 11 | */ 12 | 13 | #include "global.h" 14 | #include "dec_statistics.h" 15 | #include "memalloc.h" 16 | 17 | /*! 18 | *********************************************************************** 19 | * \brief 20 | * allocates and initializes decoder statistics memory 21 | * \param stats 22 | * Decoder statistics 23 | * \return 24 | *********************************************************************** 25 | */ 26 | void init_dec_stats(DecStatParameters *stats) 27 | { 28 | int i, j; 29 | int64 *hist; 30 | for (i = 0; i < NUM_SLICE_TYPES; i++) 31 | { 32 | stats->frame_ctr[i] = 0; 33 | for (j = 0; j < MAXMODE; j++) 34 | { 35 | stats->mode_use [i][j] = 0; 36 | stats->mode_use_transform[i][j][0] = 0; 37 | stats->mode_use_transform[i][j][1] = 0; 38 | } 39 | } 40 | 41 | for (i = 0; i < 2; i++) 42 | { 43 | for (j = 0; j < 2; j++) 44 | { 45 | if ((hist = (int64 *) malloc (4096 * sizeof (int64)))== NULL) 46 | no_mem_exit ("init_dec_stats: stats->histogram_mv"); 47 | memset(hist, 0, 4096 * sizeof (int64)); 48 | stats->histogram_mv[i][j] = hist + 2048; 49 | } 50 | if ((hist = (int64 *) malloc (17 * sizeof (int64)))== NULL) 51 | no_mem_exit ("init_dec_stats: stats->histogram_refs"); 52 | memset(hist, 0, 17 * sizeof (int64)); 53 | stats->histogram_refs[i] = hist + 1; 54 | } 55 | } 56 | 57 | void delete_dec_stats(DecStatParameters *stats) 58 | { 59 | int i, j; 60 | 61 | for (i = 0; i < 2; i++) 62 | { 63 | for (j = 0; j < 2; j++) 64 | { 65 | stats->histogram_mv[i][j] -= 2048; 66 | free(stats->histogram_mv[i][j]); 67 | } 68 | stats->histogram_refs[i] -= 1; 69 | free(stats->histogram_refs[i]); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lcommon/inc/typedefs.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************************* 3 | * \file typedefs.h 4 | * 5 | * \brief 6 | * Common type definitions 7 | * Currently only supports Windows and Linux operating systems. 8 | * Need to add support for other "older systems such as VAX, DECC, Unix Alpha etc 9 | * 10 | * \author 11 | * Main contributors (see contributors.h for copyright, address and affiliation details) 12 | * - Alexis Michael Tourapis 13 | ************************************************************************************* 14 | */ 15 | 16 | #ifndef _TYPEDEFS_H_ 17 | #define _TYPEDEFS_H_ 18 | 19 | #include "win32.h" 20 | 21 | typedef unsigned char byte; //!< byte type definition 22 | typedef unsigned char uint8; //!< type definition for unsigned char (same as byte, 8 bits) 23 | typedef unsigned short uint16; //!< type definition for unsigned short (16 bits) 24 | typedef unsigned int uint32; //!< type definition for unsigned int (32 bits) 25 | 26 | typedef char int8; 27 | typedef short int16; 28 | typedef int int32; 29 | 30 | #if IMGTYPE == 0 31 | typedef byte imgpel; //!< pixel type 32 | typedef uint16 distpel; //!< distortion type (for pixels) 33 | typedef int32 distblk; //!< distortion type (for Macroblock) 34 | typedef int32 transpel; //!< transformed coefficient type 35 | #else 36 | typedef uint16 imgpel; 37 | typedef uint32 distpel; 38 | typedef int64 distblk; 39 | typedef int32 transpel; 40 | #endif 41 | 42 | //! Boolean Type 43 | #ifdef FALSE 44 | # define Boolean int 45 | #else 46 | typedef enum { 47 | FALSE, 48 | TRUE 49 | } Boolean; 50 | #endif 51 | 52 | #ifndef MAXINT64 53 | #define MAXINT64 0x7fffffffffffffff 54 | #endif 55 | 56 | /* 57 | #define MAXUINT8 0xff 58 | #define MAXUINT16 0xffff 59 | #define MAXUINT32 0xffffffff 60 | #define MAXUINT64 0xffffffffffffffff 61 | 62 | #define MAXINT8 0x7f 63 | #define MININT8 (-MAXINT8) 64 | #define MAXINT16 0x7fff 65 | #define MININT16 (-MAXINT16) 66 | #define MAXINT32 0x7fffffff 67 | #define MININT32 (-MAXINT32) 68 | #define MAXINT64 0x7fffffffffffffff 69 | #define MININT64 (-MAXINT64) 70 | */ 71 | 72 | #endif 73 | 74 | -------------------------------------------------------------------------------- /ldecod/inc/mb_prediction.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************* 4 | * \file mb_prediction.h 5 | * 6 | * \brief 7 | * Functions for macroblock prediction 8 | * 9 | * \author 10 | * Main contributors (see contributors.h for copyright, address and affiliation details) 11 | * - Alexis Michael Tourapis 12 | ************************************************************************************* 13 | */ 14 | 15 | #ifndef _MB_PREDICTION_H_ 16 | #define _MB_PREDICTION_H_ 17 | 18 | extern int mb_pred_intra4x4 (Macroblock *currMB, ColorPlane curr_plane, imgpel **currImg, StorablePicture *dec_picture); 19 | extern int mb_pred_intra16x16 (Macroblock *currMB, ColorPlane curr_plane, StorablePicture *dec_picture); 20 | extern int mb_pred_intra8x8 (Macroblock *currMB, ColorPlane curr_plane, imgpel **currImg, StorablePicture *dec_picture); 21 | 22 | extern int mb_pred_skip (Macroblock *currMB, ColorPlane curr_plane, imgpel **currImg, StorablePicture *dec_picture); 23 | extern int mb_pred_sp_skip (Macroblock *currMB, ColorPlane curr_plane, StorablePicture *dec_picture); 24 | extern int mb_pred_p_inter8x8 (Macroblock *currMB, ColorPlane curr_plane, StorablePicture *dec_picture); 25 | extern int mb_pred_p_inter16x16 (Macroblock *currMB, ColorPlane curr_plane, StorablePicture *dec_picture); 26 | extern int mb_pred_p_inter16x8 (Macroblock *currMB, ColorPlane curr_plane, StorablePicture *dec_picture); 27 | extern int mb_pred_p_inter8x16 (Macroblock *currMB, ColorPlane curr_plane, StorablePicture *dec_picture); 28 | extern int mb_pred_b_d4x4spatial (Macroblock *currMB, ColorPlane curr_plane, imgpel **currImg, StorablePicture *dec_picture); 29 | extern int mb_pred_b_d8x8spatial (Macroblock *currMB, ColorPlane curr_plane, imgpel **currImg, StorablePicture *dec_picture); 30 | extern int mb_pred_b_d4x4temporal(Macroblock *currMB, ColorPlane curr_plane, imgpel **currImg, StorablePicture *dec_picture); 31 | extern int mb_pred_b_d8x8temporal(Macroblock *currMB, ColorPlane curr_plane, imgpel **currImg, StorablePicture *dec_picture); 32 | extern int mb_pred_b_inter8x8 (Macroblock *currMB, ColorPlane curr_plane, StorablePicture *dec_picture); 33 | extern int mb_pred_ipcm (Macroblock *currMB); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /lcommon/inc/io_video.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************ 3 | * \file io_video.h 4 | * 5 | * \brief 6 | * Video I/O 7 | * 8 | * \author 9 | * - Alexis Michael Tourapis 10 | * 11 | ************************************************************************ 12 | */ 13 | 14 | #ifndef _IO_VIDEO_H_ 15 | #define _IO_VIDEO_H_ 16 | 17 | #include "frame.h" 18 | 19 | typedef struct video_size { 20 | char* name; 21 | int x_size; 22 | int y_size; 23 | } VIDEO_SIZE; 24 | 25 | typedef enum { 26 | VIDEO_UNKNOWN = -1, 27 | VIDEO_YUV = 0, 28 | VIDEO_RGB = 1, 29 | VIDEO_XYZ = 2, 30 | VIDEO_TIFF = 3, 31 | VIDEO_AVI = 4 32 | } VideoFileType; 33 | 34 | typedef struct video_data_file 35 | { 36 | //char* fname; //!< video file name 37 | char fname[FILE_NAME_SIZE]; //!< video file name 38 | char fhead[FILE_NAME_SIZE]; //!< header of video file 39 | char ftail[FILE_NAME_SIZE]; //!< tail of video file 40 | int f_num; //!< video file number 41 | VideoFileType vdtype; //!< File format 42 | FrameFormat format; //!< video format information 43 | int is_concatenated; //!< Single or multifile input? 44 | int is_interleaved; //!< Support for interleaved and non-interleaved input sources 45 | int zero_pad; //!< Used when separate image files are used as input. Enables zero padding for file numbering 46 | int num_digits; //!< Number of digits for file numbering 47 | int start_frame; //!< start frame 48 | int end_frame; //!< end frame 49 | int nframes; //!< number of frames 50 | int crop_x_size; //!< crop information (x component) 51 | int crop_y_size; //!< crop information (y component) 52 | int crop_x_offset; //!< crop offset (x component); 53 | int crop_y_offset; //!< crop offset (y component); 54 | 55 | // AVI related information to be added here 56 | int* avi; 57 | //avi_t* avi; 58 | //int header; 59 | //char compressor[8]; 60 | } VideoDataFile; 61 | 62 | #endif 63 | 64 | -------------------------------------------------------------------------------- /lencod/inc/conformance.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file conformance.h 5 | * 6 | * \brief 7 | * Level & Profile Related definitions 8 | * 9 | * \author 10 | * Alexis Michael Tourapis \n 11 | * 12 | ************************************************************************ 13 | */ 14 | 15 | #ifndef _CONFORMANCE_H_ 16 | #define _CONFORMANCE_H_ 17 | 18 | extern Boolean is_valid_level (unsigned int profileIdc, unsigned int levelIdc); 19 | extern int get_level_index (unsigned int profile_idc, unsigned int level_idc, unsigned int constrained_set3_flag); 20 | extern void profile_check (InputParameters *p_Inp); 21 | extern void level_check (VideoParameters *p_Vid, InputParameters *p_Inp); 22 | extern void update_mv_limits (VideoParameters *p_Vid, byte is_field); 23 | extern void clip_mv_range (VideoParameters *p_Vid, int search_range, MotionVector *mv, int res); 24 | extern int out_of_bounds_mvs (VideoParameters *p_Vid, const MotionVector *mv); 25 | extern void test_clip_mvs (VideoParameters *p_Vid, MotionVector *mv, Boolean write_mb); 26 | extern Boolean CheckPredictionParams(Macroblock *currMB, Block8x8Info *b8x8info, int mode); 27 | 28 | extern unsigned int getMaxMBPS(unsigned int profile_idc, unsigned int level_idc, unsigned int constrained_set3_flag); 29 | extern unsigned int getMinCR (unsigned int profile_idc, unsigned int level_idc, unsigned int constrained_set3_flag); 30 | extern unsigned int getMaxBR (unsigned int profile_idc, unsigned int level_idc, unsigned int constrained_set3_flag); 31 | extern unsigned int getMaxCPB (unsigned int profile_idc, unsigned int level_idc, unsigned int constrained_set3_flag); 32 | 33 | typedef enum{ 34 | LEVEL_1 = 0, 35 | LEVEL_1b = 1, 36 | LEVEL_1_1 = 2, 37 | LEVEL_1_2 = 3, 38 | LEVEL_1_3 = 4, 39 | LEVEL_2 = 5, 40 | LEVEL_2_1 = 6, 41 | LEVEL_2_2 = 7, 42 | LEVEL_3 = 8, 43 | LEVEL_3_1 = 9, 44 | LEVEL_3_2 = 10, 45 | LEVEL_4 = 11, 46 | LEVEL_4_1 = 12, 47 | LEVEL_4_2 = 13, 48 | LEVEL_5 = 14, 49 | LEVEL_5_1 = 15, 50 | LEVEL_5_2 = 16, 51 | LEVEL_6 = 17, 52 | LEVEL_6_1 = 18, 53 | LEVEL_6_2 = 19, 54 | LEVEL_UNCONSTRAINED = 20 55 | } LevelId; 56 | 57 | #endif 58 | 59 | -------------------------------------------------------------------------------- /rtpdump/rtpdump.cpp: -------------------------------------------------------------------------------- 1 | 2 | // rtpdump.cpp : Defines the entry point for the console application. 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | #if defined(WIN32) || defined(WIN64) 9 | #include 10 | #else 11 | #include 12 | #endif 13 | 14 | 15 | int main(int argc, char* argv[]) 16 | { 17 | unsigned int bufsize, pacno=0, temp32; 18 | unsigned short temp16; 19 | unsigned char buf[65000]; 20 | int i, intime; 21 | FILE *f; 22 | 23 | if (argc != 2) 24 | { 25 | printf ("This tool displays information about the RTP packets in the given input file."); 26 | printf ("Note: the input file needs to be a H.264/AVC RTP dump file (lencod: OutFileMode=1)"); 27 | printf ("Usage: %s input_file\n", argv[0]); 28 | return -1; 29 | } 30 | 31 | if (NULL == (f = fopen (argv[1], "rb"))) 32 | { 33 | printf ("%s: cannot open H.264 packet file %s for reading\n", argv[0], argv[1]); 34 | return -2; 35 | } 36 | 37 | for (;;) 38 | { 39 | if (4 != fread (&bufsize, 1, 4, f)) 40 | return 0; 41 | 42 | if (4 != fread (&intime, 1, 4, f)) 43 | { 44 | printf ("Panic, cannot read timestamp (is this a valid RTP dump file?)\n"); 45 | return -1; 46 | } 47 | printf ("\n\npacket #%4d containing %5d bytes\n", pacno++, bufsize); 48 | if (bufsize != fread (buf, 1, bufsize, f)) 49 | { 50 | printf ("Cannot read packet with indicated length (is this a valid RTP dump file?)\n"); 51 | return -3; 52 | } 53 | 54 | for (i=0; i< 25; i++) 55 | printf ("%02x ", buf[i]); 56 | 57 | printf ("\n"); 58 | printf ("Version (V): %d\n", (buf[0] >> 6) & 0x03); 59 | printf ("Padding (P): %d\n", (buf[0] >> 5) & 0x01); 60 | printf ("Extension (X): %d\n", (buf[0] >> 4) & 0x01); 61 | printf ("CSRC count (CC): %d\n", (buf[0] >> 0) & 0x0F); 62 | printf ("Marker bit (M): %d\n", (buf[1] >> 7) & 0x01); 63 | printf ("Payload Type (PT): %d\n", (buf[1] >> 0) & 0x7F); 64 | memcpy (&temp16, &buf[2], 2); 65 | printf ("Sequence Number: %d\n", ntohs(temp16)); 66 | memcpy (&temp32, &buf[4], 4); 67 | printf ("Timestamp: %d\n", ntohl(temp32)); 68 | memcpy (&temp32, &buf[8], 4); 69 | printf ("SSRC: %d\n", ntohl(temp32)); 70 | 71 | printf ("First Byte: 0x%x\n", buf[12]); 72 | } 73 | } 74 | 75 | -------------------------------------------------------------------------------- /lencod/src/quantChroma.c: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************* 4 | * \file quantChroma.c 5 | * 6 | * \brief 7 | * Quantization initialization function for Chroma blocks 8 | * 9 | * \author 10 | * Main contributors (see contributors.h for copyright, address and affiliation details) 11 | * - Alexis Michael Tourapis 12 | * 13 | ************************************************************************************* 14 | */ 15 | 16 | #include "contributors.h" 17 | 18 | #include "global.h" 19 | #include "quant4x4.h" 20 | #include "quantChroma.h" 21 | 22 | /*! 23 | ************************************************************************ 24 | * \brief 25 | * Quantization initialization function 26 | * 27 | ************************************************************************ 28 | */ 29 | void init_quant_Chroma(Slice *currSlice) 30 | { 31 | VideoParameters *p_Vid = currSlice->p_Vid; 32 | InputParameters *p_Inp = currSlice->p_Inp; 33 | 34 | if (p_Inp->UseRDOQuant == 1 && p_Inp->RDOQ_CR == 1) 35 | { 36 | currSlice->quant_ac4x4cr = quant_ac4x4_trellis; 37 | if (p_Inp->RDOQ_DC_CR) 38 | { 39 | if (p_Vid->yuv_format == YUV422) 40 | currSlice->quant_dc_cr = quant_dc4x2_trellis; 41 | else 42 | currSlice->quant_dc_cr = quant_dc2x2_trellis; 43 | } 44 | else 45 | { 46 | if (p_Vid->yuv_format == YUV422) 47 | currSlice->quant_dc_cr = quant_dc4x2_normal; 48 | else 49 | currSlice->quant_dc_cr = quant_dc2x2_normal; 50 | } 51 | if (currSlice->symbol_mode == CABAC) 52 | currSlice->rdoq_dc_cr = rdoq_dc_cr_CABAC; 53 | else 54 | currSlice->rdoq_dc_cr = rdoq_dc_cr_CAVLC; 55 | } 56 | else if (p_Inp->UseRDOQuant == 1 || (!(currSlice->p_Vid)->AdaptiveRounding)) 57 | { 58 | currSlice->quant_ac4x4cr = quant_ac4x4_normal; 59 | if (p_Vid->yuv_format == YUV422) 60 | currSlice->quant_dc_cr = quant_dc4x2_normal; 61 | else 62 | currSlice->quant_dc_cr = quant_dc2x2_normal; 63 | } 64 | else 65 | { 66 | currSlice->quant_ac4x4cr = quant_ac4x4_around; 67 | if (p_Vid->yuv_format == YUV422) 68 | currSlice->quant_dc_cr = quant_dc4x2_around; 69 | else 70 | currSlice->quant_dc_cr = quant_dc2x2_around; 71 | } 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /lcommon/inc/vui_params.h: -------------------------------------------------------------------------------- 1 | /*! 2 | ************************************************************************ 3 | * \file vui_params.h 4 | * 5 | * \brief 6 | * Input parameters related definitions 7 | * 8 | * \author 9 | * 10 | ************************************************************************ 11 | */ 12 | 13 | #ifndef _VUI_PARAMS_H_ 14 | #define _VUI_PARAMS_H_ 15 | 16 | // VUI Parameters 17 | typedef struct vui_parameters 18 | { 19 | int aspect_ratio_info_present_flag; 20 | int aspect_ratio_idc; 21 | int sar_width; 22 | int sar_height; 23 | int overscan_info_present_flag; 24 | int overscan_appropriate_flag; 25 | int video_signal_type_present_flag; 26 | int video_format; 27 | int video_full_range_flag; 28 | int colour_description_present_flag; 29 | int colour_primaries; 30 | int transfer_characteristics; 31 | int matrix_coefficients; 32 | int chroma_location_info_present_flag; 33 | int chroma_sample_loc_type_top_field; 34 | int chroma_sample_loc_type_bottom_field; 35 | int timing_info_present_flag; 36 | int num_units_in_tick; 37 | int time_scale; 38 | int fixed_frame_rate_flag; 39 | int nal_hrd_parameters_present_flag; 40 | int nal_cpb_cnt_minus1; 41 | int nal_bit_rate_scale; 42 | int nal_cpb_size_scale; 43 | int nal_bit_rate_value_minus1; 44 | int nal_cpb_size_value_minus1; 45 | int nal_vbr_cbr_flag; 46 | int nal_initial_cpb_removal_delay_length_minus1; 47 | int nal_cpb_removal_delay_length_minus1; 48 | int nal_dpb_output_delay_length_minus1; 49 | int nal_time_offset_length; 50 | int vcl_hrd_parameters_present_flag; 51 | int vcl_cpb_cnt_minus1; 52 | int vcl_bit_rate_scale; 53 | int vcl_cpb_size_scale; 54 | int vcl_bit_rate_value_minus1; 55 | int vcl_cpb_size_value_minus1; 56 | int vcl_vbr_cbr_flag; 57 | int vcl_initial_cpb_removal_delay_length_minus1; 58 | int vcl_cpb_removal_delay_length_minus1; 59 | int vcl_dpb_output_delay_length_minus1; 60 | int vcl_time_offset_length; 61 | int low_delay_hrd_flag; 62 | int pic_struct_present_flag; 63 | int bitstream_restriction_flag; 64 | int motion_vectors_over_pic_boundaries_flag; 65 | int max_bytes_per_pic_denom; 66 | int max_bits_per_mb_denom; 67 | int log2_max_mv_length_vertical; 68 | int log2_max_mv_length_horizontal; 69 | int num_reorder_frames; 70 | int max_dec_frame_buffering; 71 | } VUIParameters; 72 | 73 | #endif 74 | 75 | -------------------------------------------------------------------------------- /lencod/inc/quantChroma.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file quantChroma.h 5 | * 6 | * \brief 7 | * Quantization process for chroma header file 8 | * 9 | * \author 10 | * Limin Liu 11 | * Alexis Michael Tourapis 12 | * 13 | ************************************************************************ 14 | */ 15 | 16 | #ifndef _QUANT_CR_H_ 17 | #define _QUANT_CR_H_ 18 | 19 | extern void init_quant_Chroma(Slice *currSlice); 20 | 21 | extern int quant_dc2x2_normal (Macroblock *currMB, int **tblock, int qp, int* DCLevel, int* DCRun, 22 | LevelQuantParams *q_params_4x4, int **fadjust2x2, const byte (*pos_scan)[2]); 23 | 24 | extern int quant_dc2x2_around (Macroblock *currMB, int **tblock, int qp, int* DCLevel, int* DCRun, 25 | LevelQuantParams *q_params_4x4, int **fadjust2x2, const byte (*pos_scan)[2]); 26 | 27 | extern int quant_dc2x2_trellis(Macroblock *currMB, int **tblock, int qp, int* DCLevel, int* DCRun, 28 | LevelQuantParams *q_params_4x4, int **fadjust, const byte (*pos_scan)[2]); 29 | 30 | extern int quant_dc4x2_normal (Macroblock *currMB, int **tblock, int qp, int* DCLevel, int* DCRun, 31 | LevelQuantParams *q_params_4x4, int **fadjust, const byte (*pos_scan)[2]); 32 | 33 | extern int quant_dc4x2_around (Macroblock *currMB, int **tblock, int qp, int* DCLevel, int* DCRun, 34 | LevelQuantParams *q_params_4x4, int **fadjust, const byte (*pos_scan)[2]); 35 | 36 | extern int quant_dc4x2_trellis(Macroblock *currMB, int **tblock, int qp, int* DCLevel, int* DCRun, 37 | LevelQuantParams *q_params_4x4, int **fadjust, const byte (*pos_scan)[2]); 38 | 39 | extern void rdoq_dc_cr_CAVLC (Macroblock *currMB, int **tblock, int qp_per, int qp_rem, 40 | LevelQuantParams *q_params_4x4, 41 | const byte (*pos_scan)[2], int levelTrellis[16], int type); 42 | 43 | extern void rdoq_dc_cr_CABAC (Macroblock *currMB, int **tblock, int qp_per, int qp_rem, 44 | LevelQuantParams *q_params_4x4, const byte (*pos_scan)[2], int levelTrellis[16], int type); 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /lencod/inc/rtp.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | *************************************************************************** 4 | * 5 | * \file rtp.h 6 | * 7 | * \brief 8 | * Definition of structures and functions to handle RTP headers. For a 9 | * description of RTP see RFC1889 on http://www.ietf.org 10 | * 11 | * \date 12 | * 30 September 2001 13 | * 14 | * \author 15 | * Stephan Wenger stewe@cs.tu-berlin.de 16 | **************************************************************************/ 17 | 18 | #ifndef _RTP_H_ 19 | #define _RTP_H_ 20 | 21 | #include "nalu.h" 22 | 23 | #define MAXRTPPAYLOADLEN (65536 - 40) //!< Maximum payload size of an RTP packet 24 | #define MAXRTPPACKETSIZE (65536 - 28) //!< Maximum size of an RTP packet incl. header 25 | #define H264PAYLOADTYPE 105 //!< RTP paylaod type fixed here for simplicity 26 | #define H264SSRC 0x12345678 //!< SSRC, chosen to simplify debugging 27 | #define RTP_TR_TIMESTAMP_MULT 1000 //!< should be something like 27 Mhz / 29.97 Hz 28 | 29 | typedef struct 30 | { 31 | unsigned int v; //!< Version, 2 bits, MUST be 0x2 32 | unsigned int p; //!< Padding bit, Padding MUST NOT be used 33 | unsigned int x; //!< Extension, MUST be zero 34 | unsigned int cc; /*!< CSRC count, normally 0 in the absence 35 | of RTP mixers */ 36 | unsigned int m; //!< Marker bit 37 | unsigned int pt; //!< 7 bits, Payload Type, dynamically established 38 | unsigned int seq; /*!< RTP sequence number, incremented by one for 39 | each sent packet */ 40 | unsigned int timestamp; //!< timestamp, 27 MHz for H.264 41 | unsigned int ssrc; //!< Synchronization Source, chosen randomly 42 | byte * payload; //!< the payload including payload headers 43 | unsigned int paylen; //!< length of payload in bytes 44 | byte * packet; //!< complete packet including header and payload 45 | unsigned int packlen; //!< length of packet, typically paylen+12 46 | } RTPpacket_t; 47 | 48 | extern void RTPUpdateTimestamp (VideoParameters *p_Vid, int tr); 49 | extern void OpenRTPFile (char *Filename, FILE **f_rtp); 50 | extern void CloseRTPFile (FILE *f_rtp); 51 | extern int WriteRTPNALU (VideoParameters *p_Vid, NALU_t *n, FILE **f_rtp); 52 | 53 | 54 | 55 | #endif 56 | 57 | -------------------------------------------------------------------------------- /lencod/inc/transform8x8.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | *************************************************************************** 4 | * 5 | * \file transform8x8.h 6 | * 7 | * \brief 8 | * prototypes of 8x8 transform functions 9 | * 10 | * \date 11 | * 9. October 2003 12 | * 13 | * \author 14 | * Main contributors (see contributors.h for copyright, address and affiliation details) 15 | * Yuri Vatis 16 | **************************************************************************/ 17 | 18 | #ifndef _TRANSFORM8X8_H_ 19 | #define _TRANSFORM8X8_H_ 20 | extern int mode_decision_for_I8x8_MB (Macroblock *currMB, int lambda, distblk *min_cost); 21 | extern int mode_decision_for_I8x8_blocks_JM_Low (Macroblock *currMB, int b8, int lambda, distblk *min_cost); 22 | extern int mode_decision_for_I8x8_blocks_JM_High (Macroblock *currMB, int b8, int lambda, distblk *min_cost); 23 | extern int mode_decision_for_I8x8_blocks_JM_Low444 (Macroblock *currMB, int b8, int lambda, distblk *min_cost); 24 | extern int mode_decision_for_I8x8_blocks_JM_High444(Macroblock *currMB, int b8, int lambda, distblk *min_cost); 25 | 26 | extern distblk rdcost_for_8x8_intra_blocks (Macroblock *currMB, int *c_nz, int b8, int ipmode, int lambda, distblk min_rdcost, int mostProbableMode); 27 | extern distblk rdcost_for_8x8_intra_blocks_444 (Macroblock *currMB, int *c_nz, int b8, int ipmode, int lambda, distblk min_rdcost, int mostProbableMode); 28 | extern distblk compute_satd8x8_cost (VideoParameters *p_Vid, imgpel **cur_img, imgpel **mpr8x8, int pic_opix_x, distblk min_cost); 29 | extern distblk compute_sse8x8_cost (VideoParameters *p_Vid, imgpel **cur_img, imgpel **mpr8x8, int pic_opix_x, distblk min_cost); 30 | extern distblk compute_sad8x8_cost (VideoParameters *p_Vid, imgpel **cur_img, imgpel **mpr8x8, int pic_opix_x, distblk min_cost); 31 | extern distblk compute_comp8x8_cost (VideoParameters *p_Vid, imgpel **cur_img, imgpel **mpr8x8, int pic_opix_x, distblk min_cost); 32 | 33 | extern int residual_transform_quant_luma_8x8 (Macroblock *currMB, ColorPlane pl, int b8, int *coeff_cost, int intra); 34 | extern int residual_transform_quant_luma_8x8_cavlc (Macroblock *currMB, ColorPlane pl, int b8, int *coeff_cost, int intra); 35 | extern int residual_transform_quant_luma_8x8_ls (Macroblock *currMB, ColorPlane pl, int b8, int *coeff_cost, int intra); 36 | 37 | #endif //_TRANSFORM8X8_H_ 38 | -------------------------------------------------------------------------------- /lencod/inc/block.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file block.h 5 | * 6 | * \brief 7 | * constant arrays for single block processing 8 | * 9 | * \author 10 | * Inge Lille-Langoy \n 11 | * Telenor Satellite Services \n 12 | * P.O.Box 6914 St.Olavs plass \n 13 | * N-0130 Oslo, Norway 14 | * 15 | ************************************************************************ 16 | */ 17 | 18 | #ifndef _BLOCK_H_ 19 | #define _BLOCK_H_ 20 | 21 | 22 | #include "global.h" 23 | 24 | extern int residual_transform_quant_luma_4x4(Macroblock *currMB, ColorPlane pl, int block_x,int block_y, int *coeff_cost, int intra); 25 | 26 | static const byte QP_SCALE_CR[52]= 27 | { 28 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27, 29 | 28,29,29,30,31,32,32,33,34,34,35,35,36,36,37,37, 37,38,38,38,39,39,39,39 30 | }; 31 | 32 | //! look up tables for FRExt_chroma support 33 | static const unsigned char subblk_offset_x[3][8][4] = 34 | { 35 | { 36 | {0, 4, 0, 4}, 37 | {0, 4, 0, 4}, 38 | {0, 0, 0, 0}, 39 | {0, 0, 0, 0}, 40 | {0, 0, 0, 0}, 41 | {0, 0, 0, 0}, 42 | {0, 0, 0, 0}, 43 | {0, 0, 0, 0}, 44 | }, 45 | { 46 | {0, 4, 0, 4}, 47 | {0, 4, 0, 4}, 48 | {0, 4, 0, 4}, 49 | {0, 4, 0, 4}, 50 | {0, 0, 0, 0}, 51 | {0, 0, 0, 0}, 52 | {0, 0, 0, 0}, 53 | {0, 0, 0, 0}, 54 | }, 55 | { 56 | {0, 4, 0, 4}, 57 | {8,12, 8,12}, 58 | {0, 4, 0, 4}, 59 | {8,12, 8,12}, 60 | {0, 4, 0, 4}, 61 | {8,12, 8,12}, 62 | {0, 4, 0, 4}, 63 | {8,12, 8,12} 64 | } 65 | }; 66 | 67 | 68 | static const unsigned char subblk_offset_y[3][8][4] = 69 | { 70 | { 71 | {0, 0, 4, 4}, 72 | {0, 0, 4, 4}, 73 | {0, 0, 0, 0}, 74 | {0, 0, 0, 0}, 75 | {0, 0, 0, 0}, 76 | {0, 0, 0, 0}, 77 | {0, 0, 0, 0}, 78 | {0, 0, 0, 0} 79 | }, 80 | { 81 | {0, 0, 4, 4}, 82 | {8, 8,12,12}, 83 | {0, 0, 4, 4}, 84 | {8, 8,12,12}, 85 | {0, 0, 0, 0}, 86 | {0, 0, 0, 0}, 87 | {0, 0, 0, 0}, 88 | {0, 0, 0, 0} 89 | }, 90 | { 91 | {0, 0, 4, 4}, 92 | {0, 0, 4, 4}, 93 | {8, 8,12,12}, 94 | {8, 8,12,12}, 95 | {0, 0, 4, 4}, 96 | {0, 0, 4, 4}, 97 | {8, 8,12,12}, 98 | {8, 8,12,12} 99 | } 100 | }; 101 | 102 | #endif 103 | 104 | -------------------------------------------------------------------------------- /lencod/src/rdpicdecision.c: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************* 4 | * \file rdpicdecision.c 5 | * 6 | * \brief 7 | * Perform RD optimal decisions between multiple coded versions of the same picture 8 | * 9 | * \author 10 | * Main contributors (see contributors.h for copyright, address and affiliation details) 11 | * - Alexis Michael Tourapis 12 | ************************************************************************************* 13 | */ 14 | 15 | #include "global.h" 16 | #include 17 | 18 | 19 | /*! 20 | ************************************************************************ 21 | * \brief 22 | * RD decision between possible encoding cases 23 | ************************************************************************ 24 | */ 25 | int rd_pic_decision(double snrY_version1, double snrY_version2, int bits_version1, int bits_version2, double lambda_picture) 26 | { 27 | double cost_version1, cost_version2; 28 | 29 | cost_version1 = (double) bits_version1 * lambda_picture + snrY_version1; 30 | cost_version2 = (double) bits_version2 * lambda_picture + snrY_version2; 31 | //printf("%d %d %.2f %.2f %.2f %.2f \n",bits_version1,bits_version2,snrY_version1,snrY_version2,cost_version1,cost_version2); 32 | if (cost_version2 > cost_version1 || (cost_version2 == cost_version1 && snrY_version2 >= snrY_version1) ) 33 | return (0); 34 | else 35 | return (1); 36 | } 37 | 38 | /*! 39 | ************************************************************************ 40 | * \brief 41 | * Picture Coding Decision 42 | ************************************************************************ 43 | */ 44 | int picture_coding_decision (VideoParameters *p_Vid, Picture *picture1, Picture *picture2, int qp) 45 | { 46 | double lambda_picture; 47 | double sse_picture1, sse_picture2; 48 | 49 | if (p_Vid->p_Inp->NumberBFrames) 50 | lambda_picture = (qp < 20 ? 0.55 : 0.68) * pow (2, (qp - SHIFT_QP) / 3.0) * ((p_Vid->type == B_SLICE) || (p_Vid->type == SP_SLICE || p_Vid->type == SI_SLICE) ? 2 : 1); 51 | else 52 | lambda_picture = (qp < 20 ? 0.55 : 0.68) * pow (2, (qp - SHIFT_QP) / 3.0); 53 | 54 | if(picture1->distortion.value[0] == 0) 55 | return 0; 56 | else if(picture2->distortion.value[0] == 0) 57 | return 1; 58 | 59 | sse_picture1 = picture1->distortion.value[0] + picture1->distortion.value[1] + picture1->distortion.value[2]; 60 | sse_picture2 = picture2->distortion.value[0] + picture2->distortion.value[1] + picture2->distortion.value[2]; 61 | 62 | return rd_pic_decision(sse_picture1, sse_picture2, picture1->bits_per_picture, picture2->bits_per_picture, lambda_picture); 63 | } 64 | 65 | -------------------------------------------------------------------------------- /bin/decoder.cfg: -------------------------------------------------------------------------------- 1 | # This is a file containing input parameters to the JVT H.264/AVC decoder. 2 | # The text line following each parameter is discarded by the decoder. 3 | # 4 | # For bug reporting and known issues see: 5 | # https://ipbt.hhi.fraunhofer.de 6 | # 7 | # New Input File Format is as follows 8 | # = # Comment 9 | # 10 | ########################################################################################## 11 | # Files 12 | ########################################################################################## 13 | InputFile = "test.264" # H.264/AVC coded bitstream 14 | OutputFile = "test_dec.yuv" # Output file, YUV/RGB 15 | RefFile = "test_rec.yuv" # Ref sequence (for SNR) 16 | WriteUV = 1 # Write 4:2:0 chroma components for monochrome streams 17 | FileFormat = 0 # NAL mode (0=Annex B, 1: RTP packets) 18 | RefOffset = 0 # SNR computation offset 19 | POCScale = 2 # Poc Scale (1 or 2) 20 | ########################################################################################## 21 | # HRD parameters 22 | ########################################################################################## 23 | #R_decoder = 500000 # Rate_Decoder 24 | #B_decoder = 104000 # B_decoder 25 | #F_decoder = 73000 # F_decoder 26 | #LeakyBucketParamFile = "leakybucketparam.cfg" # LeakyBucket Params 27 | ########################################################################################## 28 | # decoder control parameters 29 | ########################################################################################## 30 | DisplayDecParams = 0 # 1: Display parameters; 31 | ConcealMode = 0 # Err Concealment(0:Off,1:Frame Copy,2:Motion Copy) 32 | RefPOCGap = 2 # Reference POC gap (2: IPP (Default), 4: IbP / IpP) 33 | POCGap = 2 # POC gap (2: IPP /IbP/IpP (Default), 4: IPP with frame skip = 1 etc.) 34 | Silent = 0 # Silent decode 35 | IntraProfileDeblocking = 1 # Enable Deblocking filter in intra only profiles (0=disable, 1=filter according to SPS parameters) 36 | DecFrmNum = 0 # Number of frames to be decoded (-n) 37 | ########################################################################################## 38 | # MVC decoding parameters 39 | ########################################################################################## 40 | DecodeAllLayers = 0 # Decode all views (-mpr) 41 | -------------------------------------------------------------------------------- /bin/decoder_stereo.cfg: -------------------------------------------------------------------------------- 1 | # This is a file containing input parameters to the JVT H.264/AVC decoder. 2 | # The text line following each parameter is discarded by the decoder. 3 | # 4 | # For bug reporting and known issues see: 5 | # https://ipbt.hhi.fraunhofer.de 6 | # 7 | # New Input File Format is as follows 8 | # = # Comment 9 | # 10 | ########################################################################################## 11 | # Files 12 | ########################################################################################## 13 | InputFile = "test.264" # H.264/AVC coded bitstream 14 | OutputFile = "test_dec.yuv" # Output file, YUV/RGB 15 | RefFile = "test_rec.yuv" # Ref sequence (for SNR) 16 | WriteUV = 1 # Write 4:2:0 chroma components for monochrome streams 17 | FileFormat = 0 # NAL mode (0=Annex B, 1: RTP packets) 18 | RefOffset = 0 # SNR computation offset 19 | POCScale = 2 # Poc Scale (1 or 2) 20 | ########################################################################################## 21 | # HRD parameters 22 | ########################################################################################## 23 | #R_decoder = 500000 # Rate_Decoder 24 | #B_decoder = 104000 # B_decoder 25 | #F_decoder = 73000 # F_decoder 26 | #LeakyBucketParamFile = "leakybucketparam.cfg" # LeakyBucket Params 27 | ########################################################################################## 28 | # decoder control parameters 29 | ########################################################################################## 30 | DisplayDecParams = 0 # 1: Display parameters; 31 | ConcealMode = 0 # Err Concealment(0:Off,1:Frame Copy,2:Motion Copy) 32 | RefPOCGap = 2 # Reference POC gap (2: IPP (Default), 4: IbP / IpP) 33 | POCGap = 2 # POC gap (2: IPP /IbP/IpP (Default), 4: IPP with frame skip = 1 etc.) 34 | Silent = 0 # Silent decode 35 | IntraProfileDeblocking = 1 # Enable Deblocking filter in intra only profiles (0=disable, 1=filter according to SPS parameters) 36 | DecFrmNum = 0 # Number of frames to be decoded (-n) 37 | ########################################################################################## 38 | # MVC decoding parameters 39 | ########################################################################################## 40 | DecodeAllLayers = 1 # Decode all views (-mpr) 41 | -------------------------------------------------------------------------------- /lencod/inc/quant4x4.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************ 4 | * \file quant4x4.h 5 | * 6 | * \brief 7 | * Quantization process header file 8 | * 9 | * \author 10 | * Limin Liu 11 | * Alexis Michael Tourapis 12 | * 13 | ************************************************************************ 14 | */ 15 | 16 | #ifndef _QUANT4x4_H_ 17 | #define _QUANT4x4_H_ 18 | 19 | extern void init_quant_4x4 (Slice *currSlice); 20 | 21 | extern int quant_4x4_normal (Macroblock *currMB, int **tblock, struct quant_methods *q_method); 22 | extern int quant_4x4_around (Macroblock *currMB, int **tblock, struct quant_methods *q_method); 23 | extern int quant_4x4_trellis(Macroblock *currMB, int **tblock, struct quant_methods *q_method); 24 | extern int quant_dc4x4_normal (Macroblock *currMB, int **tblock, int qp, int* DCLevel, int* DCRun, 25 | LevelQuantParams *q_params_4x4, const byte (*pos_scan)[2]); 26 | 27 | extern int quant_dc4x4_around (Macroblock *currMB, int **tblock, int qp, int* DCLevel, int* DCRun, 28 | LevelQuantParams *q_params_4x4, const byte (*pos_scan)[2]); 29 | 30 | extern int quant_dc4x4_trellis(Macroblock *currMB, int **tblock, int qp, int* DCLevel, int* DCRun, 31 | LevelQuantParams *q_params_4x4, const byte (*pos_scan)[2]); 32 | 33 | extern int quant_ac4x4_normal (Macroblock *currMB, int **tblock, struct quant_methods *q_method); 34 | extern int quant_ac4x4_around (Macroblock *currMB, int **tblock, struct quant_methods *q_method); 35 | extern int quant_ac4x4_trellis(Macroblock *currMB, int **tblock, struct quant_methods *q_method); 36 | 37 | extern void rdoq_4x4_CAVLC (Macroblock *currMB, int **tblock, struct quant_methods *q_method, int levelTrellis[16]); 38 | 39 | extern void rdoq_4x4_CABAC (Macroblock *currMB, int **tblock, struct quant_methods *q_method, int levelTrellis[16]); 40 | 41 | extern void rdoq_dc_CAVLC (Macroblock *currMB, int **tblock, int qp_per, int qp_rem, LevelQuantParams *q_params_4x4, 42 | const byte (*pos_scan)[2], int levelTrellis[16], int type); 43 | 44 | extern void rdoq_dc_CABAC (Macroblock *currMB, int **tblock, int qp_per, int qp_rem, LevelQuantParams *q_params_4x4, 45 | const byte (*pos_scan)[2], int levelTrellis[16], int type); 46 | 47 | extern void rdoq_ac4x4_CAVLC (Macroblock *currMB, int **tblock, struct quant_methods *q_method, int levelTrellis[16]); 48 | 49 | extern void rdoq_ac4x4_CABAC (Macroblock *currMB, int **tblock , struct quant_methods *q_method, int levelTrellis[16]); 50 | 51 | 52 | #endif 53 | 54 | -------------------------------------------------------------------------------- /lencod/inc/biariencode.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | *************************************************************************** 4 | * \file 5 | * biariencode.h 6 | * 7 | * \brief 8 | * Headerfile for binary arithmetic encoding routines 9 | * 10 | * \author 11 | * - Detlev Marpe 12 | * - Gabi Blaettermann 13 | * - Gunnar Marten 14 | * 15 | * Copyright (C) 2000 HEINRICH HERTZ INSTITUTE All Rights Reserved. 16 | * 17 | * \date 18 | * 21. Oct 2000 19 | ************************************************************************** 20 | */ 21 | 22 | 23 | #ifndef _BIARIENCOD_H_ 24 | #define _BIARIENCOD_H_ 25 | 26 | 27 | /************************************************************************ 28 | * D e f i n i t i o n s 29 | *********************************************************************** 30 | */ 31 | 32 | // some definitions to increase the readability of the source code 33 | 34 | #define B_BITS 10 // Number of bits to represent the whole coding interval 35 | #define BITS_TO_LOAD 16 36 | #define MAX_BITS 26 //(B_BITS + BITS_TO_LOAD) 37 | #define MASK_BITS 18 //(MAX_BITS - 8) 38 | #define ONE 0x04000000 //(1 << MAX_BITS) 39 | #define ONE_M1 0x03FFFFFF //(ONE - 1) 40 | #define HALF 0x01FE //(1 << (B_BITS-1)) - 2 41 | #define QUARTER 0x0100 //(1 << (B_BITS-2)) 42 | #define MIN_BITS_TO_GO 0 43 | #define B_LOAD_MASK 0xFFFF // ((1<Ecodestrm_len) + eep->Epbuf + 1) << 3) + (eep->Echunks_outstanding * BITS_TO_LOAD) + BITS_TO_LOAD - eep->Ebits_to_go; 66 | } 67 | 68 | #endif // BIARIENCOD_H 69 | 70 | -------------------------------------------------------------------------------- /lencod/inc/parset.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | ************************************************************************************** 4 | * \file 5 | * parset.h 6 | * \brief 7 | * Picture and Sequence Parameter Sets, encoder operations 8 | * 9 | * \date 25 November 2002 10 | * \author 11 | * Main contributors (see contributors.h for copyright, address and affiliation details) 12 | * - Stephan Wenger 13 | *************************************************************************************** 14 | */ 15 | 16 | 17 | #ifndef _PARSET_H_ 18 | #define _PARSET_H_ 19 | 20 | #include "parsetcommon.h" 21 | #include "nalu.h" 22 | #include "sei.h" 23 | 24 | extern void generate_parameter_sets (VideoParameters *p_Vid); 25 | extern void FreeParameterSets (VideoParameters *p_Vid); 26 | 27 | extern NALU_t *GenerateSeq_parameter_set_NALU (VideoParameters *p_Vid); 28 | extern NALU_t *GeneratePic_parameter_set_NALU (VideoParameters *p_Vid, int); 29 | extern NALU_t *GenerateSEImessage_NALU(InputParameters *p_Inp); 30 | #if (MVC_EXTENSION_ENABLE) 31 | extern NALU_t *GenerateSubsetSeq_parameter_set_NALU (VideoParameters *p_Vid); 32 | #endif 33 | 34 | // The following are local helpers, but may come handy in the future, hence public 35 | extern void GenerateSequenceParameterSet(seq_parameter_set_rbsp_t *sps, VideoParameters *p_Vid, int SPS_id); 36 | extern void GeneratePictureParameterSet( pic_parameter_set_rbsp_t *pps, seq_parameter_set_rbsp_t *sps, 37 | VideoParameters *p_Vid, 38 | InputParameters *p_Inp, int PPS_id, 39 | int WeightedPrediction, int WeightedBiprediction, 40 | int cb_qp_index_offset, int cr_qp_index_offset); 41 | 42 | extern int Scaling_List(short *scalingListinput, short *scalingList, int sizeOfScalingList, short *UseDefaultScalingMatrix, Bitstream *bitstream); 43 | #if (MVC_EXTENSION_ENABLE) 44 | extern int GenerateSeq_parameter_set_rbsp (VideoParameters *p_Vid, seq_parameter_set_rbsp_t *sps, byte *buf, short Is_Subset); 45 | #else 46 | extern int GenerateSeq_parameter_set_rbsp (VideoParameters *p_Vid, seq_parameter_set_rbsp_t *sps, byte *buf); 47 | #endif 48 | extern int GeneratePic_parameter_set_rbsp (VideoParameters *p_Vid, pic_parameter_set_rbsp_t *pps, byte *buf); 49 | extern int GenerateSEImessage_rbsp (InputParameters *p_Inp, int id, byte *buf); 50 | extern void FreeSPS (seq_parameter_set_rbsp_t *sps); 51 | extern void FreePPS (pic_parameter_set_rbsp_t *pps); 52 | 53 | extern int WriteHRDParameters(seq_parameter_set_rbsp_t *sps, Bitstream *bitstream); 54 | extern void GenerateVUIParameters(seq_parameter_set_rbsp_t *sps, InputParameters *p_Inp); 55 | 56 | extern pic_parameter_set_rbsp_t *AllocPPS (void); 57 | extern seq_parameter_set_rbsp_t *AllocSPS (void); 58 | 59 | 60 | #endif 61 | --------------------------------------------------------------------------------