├── README.md ├── hm-14.0 ├── COPYING ├── HM.xcodeproj │ └── project.pbxproj ├── README-newconfig.txt ├── build │ ├── HM_vc10.sln │ ├── HM_vc8.sln │ ├── HM_vc9.sln │ ├── linux │ │ ├── app │ │ │ ├── TAppDecoder │ │ │ │ └── makefile │ │ │ └── TAppEncoder │ │ │ │ └── makefile │ │ ├── common │ │ │ └── makefile.base │ │ ├── lib │ │ │ ├── TAppCommon │ │ │ │ └── makefile │ │ │ ├── TLibCommon │ │ │ │ └── makefile │ │ │ ├── TLibDecoder │ │ │ │ └── makefile │ │ │ ├── TLibEncoder │ │ │ │ └── makefile │ │ │ └── TLibVideoIO │ │ │ │ └── makefile │ │ ├── makefile │ │ └── utils │ │ │ ├── annexBbytecount │ │ │ └── makefile │ │ │ └── convert_NtoMbit_YCbCr │ │ │ └── makefile │ ├── vc10 │ │ ├── TAppCommon_vc10.vcxproj │ │ ├── TAppCommon_vc10.vcxproj.filters │ │ ├── TAppDecoder_vc10.vcxproj │ │ ├── TAppDecoder_vc10.vcxproj.filters │ │ ├── TAppEncoder_vc10.vcxproj │ │ ├── TAppEncoder_vc10.vcxproj.filters │ │ ├── TLibCommon_vc10.vcxproj │ │ ├── TLibCommon_vc10.vcxproj.filters │ │ ├── TLibDecoder_vc10.vcxproj │ │ ├── TLibDecoder_vc10.vcxproj.filters │ │ ├── TLibEncoder_vc10.vcxproj │ │ ├── TLibEncoder_vc10.vcxproj.filters │ │ ├── TLibVideoIO_vc10.vcxproj │ │ └── TLibVideoIO_vc10.vcxproj.filters │ ├── vc8 │ │ ├── TAppCommon_vc8.vcproj │ │ ├── TAppDecoder_vc8.vcproj │ │ ├── TAppEncoder_vc8.vcproj │ │ ├── TLibCommon_vc8.vcproj │ │ ├── TLibDecoder_vc8.vcproj │ │ ├── TLibEncoder_vc8.vcproj │ │ └── TLibVideoIO_vc8.vcproj │ └── vc9 │ │ ├── TAppCommon_vc9.vcproj │ │ ├── TAppDecoder_vc9.vcproj │ │ ├── TAppEncoder_vc9.vcproj │ │ ├── TLibCommon_vc9.vcproj │ │ ├── TLibDecoder_vc9.vcproj │ │ ├── TLibEncoder_vc9.vcproj │ │ └── TLibVideoIO_vc9.vcproj ├── cfg │ ├── encoder_intra_main.cfg │ ├── encoder_intra_main10.cfg │ ├── encoder_lowdelay_P_main.cfg │ ├── encoder_lowdelay_P_main10.cfg │ ├── encoder_lowdelay_main.cfg │ ├── encoder_lowdelay_main10.cfg │ ├── encoder_randomaccess_main.cfg │ ├── encoder_randomaccess_main10.cfg │ ├── misc │ │ ├── encoder_randomaccess_field_coding.cfg │ │ └── encoder_randomaccess_main_4tids.cfg │ └── per-sequence │ │ ├── BQMall.cfg │ │ ├── BQSquare.cfg │ │ ├── BQTerrace.cfg │ │ ├── BasketballDrill.cfg │ │ ├── BasketballDrillText.cfg │ │ ├── BasketballDrive.cfg │ │ ├── BasketballPass.cfg │ │ ├── BlowingBubbles.cfg │ │ ├── Cactus.cfg │ │ ├── ChinaSpeed.cfg │ │ ├── FourPeople.cfg │ │ ├── Johnny.cfg │ │ ├── Kimono.cfg │ │ ├── KristenAndSara.cfg │ │ ├── NebutaFestival_10bit.cfg │ │ ├── ParkScene.cfg │ │ ├── PartyScene.cfg │ │ ├── PeopleOnStreet.cfg │ │ ├── RaceHorses.cfg │ │ ├── RaceHorsesC.cfg │ │ ├── SlideEditing.cfg │ │ ├── SlideShow.cfg │ │ ├── SteamLocomotiveTrain_10bit.cfg │ │ ├── Traffic.cfg │ │ ├── Vidyo1.cfg │ │ ├── Vidyo3.cfg │ │ └── Vidyo4.cfg ├── compat │ └── msvc │ │ └── stdint.h ├── doc │ ├── Doxyfile │ ├── Makefile │ ├── README_data-structure.ppt │ ├── README_software-manual.txt │ ├── gop-structure-example.pdf │ ├── mainpage.h │ ├── software-manual.pdf │ └── software-manual.tex └── source │ ├── App │ ├── TAppDecoder │ │ ├── TAppDecCfg.cpp │ │ ├── TAppDecCfg.h │ │ ├── TAppDecTop.cpp │ │ ├── TAppDecTop.h │ │ └── decmain.cpp │ ├── TAppEncoder │ │ ├── TAppEncCfg.cpp │ │ ├── TAppEncCfg.h │ │ ├── TAppEncTop.cpp │ │ ├── TAppEncTop.h │ │ └── encmain.cpp │ └── utils │ │ ├── BitrateTargeting │ │ ├── ExtractBitrates.cpp │ │ ├── ExtractBitrates.h │ │ ├── ExtractBitratesMain.cpp │ │ ├── GuessLambdaModifiers.cpp │ │ ├── GuessLambdaModifiers.h │ │ ├── GuessLambdaModifiersMain.cpp │ │ ├── QuickStartGuide.pdf │ │ ├── RuntimeError.h │ │ ├── encode.shl │ │ ├── encodeCommand.sh │ │ ├── makefile │ │ └── targetBitrates.sh │ │ ├── annexBbytecount.cpp │ │ └── convert_NtoMbit_YCbCr.cpp │ └── Lib │ ├── TAppCommon │ ├── program_options_lite.cpp │ └── program_options_lite.h │ ├── TLibCommon │ ├── AccessUnit.h │ ├── CommonDef.h │ ├── ContextModel.cpp │ ├── ContextModel.h │ ├── ContextModel3DBuffer.cpp │ ├── ContextModel3DBuffer.h │ ├── ContextTables.h │ ├── NAL.h │ ├── SEI.cpp │ ├── SEI.h │ ├── TComBitCounter.h │ ├── TComBitStream.cpp │ ├── TComBitStream.h │ ├── TComCABACTables.cpp │ ├── TComCABACTables.h │ ├── TComDataCU.cpp │ ├── TComDataCU.h │ ├── TComInterpolationFilter.cpp │ ├── TComInterpolationFilter.h │ ├── TComList.h │ ├── TComLoopFilter.cpp │ ├── TComLoopFilter.h │ ├── TComMotionInfo.cpp │ ├── TComMotionInfo.h │ ├── TComMv.h │ ├── TComPattern.cpp │ ├── TComPattern.h │ ├── TComPic.cpp │ ├── TComPic.h │ ├── TComPicSym.cpp │ ├── TComPicSym.h │ ├── TComPicYuv.cpp │ ├── TComPicYuv.h │ ├── TComPicYuvMD5.cpp │ ├── TComPrediction.cpp │ ├── TComPrediction.h │ ├── TComRdCost.cpp │ ├── TComRdCost.h │ ├── TComRdCostWeightPrediction.cpp │ ├── TComRdCostWeightPrediction.h │ ├── TComRom.cpp │ ├── TComRom.h │ ├── TComSampleAdaptiveOffset.cpp │ ├── TComSampleAdaptiveOffset.h │ ├── TComSlice.cpp │ ├── TComSlice.h │ ├── TComTrQuant.cpp │ ├── TComTrQuant.h │ ├── TComWeightPrediction.cpp │ ├── TComWeightPrediction.h │ ├── TComYuv.cpp │ ├── TComYuv.h │ └── TypeDef.h │ ├── TLibDecoder │ ├── AnnexBread.cpp │ ├── AnnexBread.h │ ├── NALread.cpp │ ├── NALread.h │ ├── SEIread.cpp │ ├── SEIread.h │ ├── SyntaxElementParser.cpp │ ├── SyntaxElementParser.h │ ├── TDecBinCoder.h │ ├── TDecBinCoderCABAC.cpp │ ├── TDecBinCoderCABAC.h │ ├── TDecCAVLC.cpp │ ├── TDecCAVLC.h │ ├── TDecCu.cpp │ ├── TDecCu.h │ ├── TDecEntropy.cpp │ ├── TDecEntropy.h │ ├── TDecGop.cpp │ ├── TDecGop.h │ ├── TDecSbac.cpp │ ├── TDecSbac.h │ ├── TDecSlice.cpp │ ├── TDecSlice.h │ ├── TDecTop.cpp │ └── TDecTop.h │ ├── TLibEncoder │ ├── AnnexBwrite.h │ ├── NALwrite.cpp │ ├── NALwrite.h │ ├── SEIwrite.cpp │ ├── SEIwrite.h │ ├── SyntaxElementWriter.cpp │ ├── SyntaxElementWriter.h │ ├── TEncAnalyze.cpp │ ├── TEncAnalyze.h │ ├── TEncBinCoder.h │ ├── TEncBinCoderCABAC.cpp │ ├── TEncBinCoderCABAC.h │ ├── TEncBinCoderCABACCounter.cpp │ ├── TEncBinCoderCABACCounter.h │ ├── TEncCavlc.cpp │ ├── TEncCavlc.h │ ├── TEncCfg.h │ ├── TEncCu.cpp │ ├── TEncCu.h │ ├── TEncEntropy.cpp │ ├── TEncEntropy.h │ ├── TEncGOP.cpp │ ├── TEncGOP.h │ ├── TEncPic.cpp │ ├── TEncPic.h │ ├── TEncPreanalyzer.cpp │ ├── TEncPreanalyzer.h │ ├── TEncRateCtrl.cpp │ ├── TEncRateCtrl.h │ ├── TEncSampleAdaptiveOffset.cpp │ ├── TEncSampleAdaptiveOffset.h │ ├── TEncSbac.cpp │ ├── TEncSbac.h │ ├── TEncSearch.cpp │ ├── TEncSearch.h │ ├── TEncSlice.cpp │ ├── TEncSlice.h │ ├── TEncTop.cpp │ ├── TEncTop.h │ ├── WeightPredAnalysis.cpp │ └── WeightPredAnalysis.h │ ├── TLibVideoIO │ ├── TVideoIOYuv.cpp │ └── TVideoIOYuv.h │ └── libmd5 │ ├── MD5.h │ ├── libmd5.c │ └── libmd5.h └── matlab ├── filterPrediction.m ├── getHevcIntraPredAndExtCovMtx.m ├── getHevcRefIdx.m ├── getOptimalPredictionWeights.m ├── journal_figure1.m ├── journal_figure2.m ├── journal_figure4.m ├── journal_figure5.m ├── journal_figure6.m ├── journal_figure7.m └── journal_figure8.m /README.md: -------------------------------------------------------------------------------- 1 | # Iterative Filtering Intra Prediction 2 | 3 | By [Haoming Chen](http://haomingchen.org), Tao Zhang, Ming-Ting Sun, Ankur Saxena and Madhukar Budagavi. 4 | 5 | University of Washington and Samsung Research America 6 | 7 | ### Citation 8 | If you use this code, please cite: 9 | 10 | @article{chen2016improving, 11 | title={Improving Intra Prediction in High-Efficiency Video Coding}, 12 | author={Chen, Haoming and Zhang, Tao and Sun, Ming-Ting and Saxena, Ankur and Budagavi, Madhukar}, 13 | journal={IEEE Transactions on Image Processing}, 14 | volume={25}, 15 | number={8}, 16 | pages={3671--3682}, 17 | year={2016}, 18 | publisher={IEEE} 19 | } 20 | 21 | ### Code 22 | #### matlab 23 | Code for generating figures in the paper. 24 | 25 | #### hm-14.0 26 | Implementation in the HEVC reference software. 27 | 28 | Turn on/off ITERATIVE_FILTERING_INTRA_PREDICTION to switch the proposed method and HM-14.0. 29 | -------------------------------------------------------------------------------- /hm-14.0/COPYING: -------------------------------------------------------------------------------- 1 | The copyright in this software is being made available under the BSD 2 | License, included below. This software may be subject to other third party 3 | and contributor rights, including patent rights, and no such rights are 4 | granted under this license.   5 | 6 | Copyright (c) 2010-2014, ITU/ISO/IEC 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | * Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | * Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | be used to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | THE POSSIBILITY OF SUCH DAMAGE. 32 | -------------------------------------------------------------------------------- /hm-14.0/build/linux/app/TAppDecoder/makefile: -------------------------------------------------------------------------------- 1 | # the SOURCE definiton lets you move your makefile to another position 2 | CONFIG = CONSOLE 3 | 4 | # set directories to your wanted values 5 | SRC_DIR = ../../../../source/App/TAppDecoder 6 | INC_DIR = ../../../../source/Lib 7 | LIB_DIR = ../../../../lib 8 | BIN_DIR = ../../../../bin 9 | 10 | SRC_DIR1 = 11 | SRC_DIR2 = 12 | SRC_DIR3 = 13 | SRC_DIR4 = 14 | 15 | USER_INC_DIRS = -I$(SRC_DIR) 16 | USER_LIB_DIRS = 17 | 18 | # intermediate directory for object files 19 | OBJ_DIR = ./objects 20 | 21 | # set executable name 22 | PRJ_NAME = TAppDecoder 23 | 24 | # defines to set 25 | DEFS = -DMSYS_LINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DMSYS_UNIX_LARGEFILE 26 | 27 | # set objects 28 | OBJS = \ 29 | $(OBJ_DIR)/decmain.o \ 30 | $(OBJ_DIR)/TAppDecCfg.o \ 31 | $(OBJ_DIR)/TAppDecTop.o \ 32 | 33 | # set libs to link with 34 | LIBS = -ldl 35 | 36 | DEBUG_LIBS = 37 | RELEASE_LIBS = 38 | 39 | STAT_LIBS = -lpthread 40 | DYN_LIBS = 41 | 42 | 43 | DYN_DEBUG_LIBS = -lTLibDecoderd -lTLibCommond -lTLibVideoIOd -lTAppCommond 44 | DYN_DEBUG_PREREQS = $(LIB_DIR)/libTLibDecoderd.a $(LIB_DIR)/libTLibCommond.a $(LIB_DIR)/libTLibVideoIOd.a $(LIB_DIR)/libTAppCommond.a 45 | STAT_DEBUG_LIBS = -lTLibDecoderStaticd -lTLibCommonStaticd -lTLibVideoIOStaticd -lTAppCommonStaticd 46 | STAT_DEBUG_PREREQS = $(LIB_DIR)/libTLibDecoderStaticd.a $(LIB_DIR)/libTLibCommonStaticd.a $(LIB_DIR)/libTLibVideoIOStaticd.a $(LIB_DIR)/libTAppCommonStaticd.a 47 | 48 | DYN_RELEASE_LIBS = -lTLibDecoder -lTLibCommon -lTLibVideoIO -lTAppCommon 49 | DYN_RELEASE_PREREQS = $(LIB_DIR)/libTLibDecoder.a $(LIB_DIR)/libTLibCommon.a $(LIB_DIR)/libTLibVideoIO.a $(LIB_DIR)/libTAppCommon.a 50 | STAT_RELEASE_LIBS = -lTLibDecoderStatic -lTLibCommonStatic -lTLibVideoIOStatic -lTAppCommonStatic 51 | STAT_RELEASE_PREREQS = $(LIB_DIR)/libTLibDecoderStatic.a $(LIB_DIR)/libTLibCommonStatic.a $(LIB_DIR)/libTLibVideoIOStatic.a $(LIB_DIR)/libTAppCommonStatic.a 52 | 53 | 54 | # name of the base makefile 55 | MAKE_FILE_NAME = ../../common/makefile.base 56 | 57 | # include the base makefile 58 | include $(MAKE_FILE_NAME) 59 | -------------------------------------------------------------------------------- /hm-14.0/build/linux/app/TAppEncoder/makefile: -------------------------------------------------------------------------------- 1 | # the SOURCE definiton lets you move your makefile to another position 2 | CONFIG = CONSOLE 3 | 4 | # set directories to your wanted values 5 | SRC_DIR = ../../../../source/App/TAppEncoder 6 | INC_DIR = ../../../../source/Lib 7 | LIB_DIR = ../../../../lib 8 | BIN_DIR = ../../../../bin 9 | 10 | SRC_DIR1 = 11 | SRC_DIR2 = 12 | SRC_DIR3 = 13 | SRC_DIR4 = 14 | 15 | USER_INC_DIRS = -I$(SRC_DIR) 16 | USER_LIB_DIRS = 17 | 18 | # intermediate directory for object files 19 | OBJ_DIR = ./objects 20 | 21 | # set executable name 22 | PRJ_NAME = TAppEncoder 23 | 24 | # defines to set 25 | DEFS = -DMSYS_LINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DMSYS_UNIX_LARGEFILE 26 | 27 | # set objects 28 | OBJS = \ 29 | $(OBJ_DIR)/encmain.o \ 30 | $(OBJ_DIR)/TAppEncCfg.o \ 31 | $(OBJ_DIR)/TAppEncTop.o \ 32 | 33 | # set libs to link with 34 | LIBS = -ldl 35 | 36 | DEBUG_LIBS = 37 | RELEASE_LIBS = 38 | 39 | STAT_LIBS = -lpthread 40 | DYN_LIBS = 41 | 42 | 43 | DYN_DEBUG_LIBS = -lTLibEncoderd -lTLibCommond -lTLibVideoIOd -lTAppCommond 44 | DYN_DEBUG_PREREQS = $(LIB_DIR)/libTLibEncoderd.a $(LIB_DIR)/libTLibCommond.a $(LIB_DIR)/libTLibVideoIOd.a $(LIB_DIR)/libTAppCommond.a 45 | STAT_DEBUG_LIBS = -lTLibEncoderStaticd -lTLibCommonStaticd -lTLibVideoIOStaticd -lTAppCommonStaticd 46 | STAT_DEBUG_PREREQS = $(LIB_DIR)/libTLibEncoderStaticd.a $(LIB_DIR)/libTLibCommonStaticd.a $(LIB_DIR)/libTLibVideoIOStaticd.a $(LIB_DIR)/libTAppCommonStaticd.a 47 | 48 | DYN_RELEASE_LIBS = -lTLibEncoder -lTLibCommon -lTLibVideoIO -lTAppCommon 49 | DYN_RELEASE_PREREQS = $(LIB_DIR)/libTLibEncoder.a $(LIB_DIR)/libTLibCommon.a $(LIB_DIR)/libTLibVideoIO.a $(LIB_DIR)/libTAppCommon.a 50 | STAT_RELEASE_LIBS = -lTLibEncoderStatic -lTLibCommonStatic -lTLibVideoIOStatic -lTAppCommonStatic 51 | STAT_RELEASE_PREREQS = $(LIB_DIR)/libTLibEncoderStatic.a $(LIB_DIR)/libTLibCommonStatic.a $(LIB_DIR)/libTLibVideoIOStatic.a $(LIB_DIR)/libTAppCommonStatic.a 52 | 53 | 54 | # name of the base makefile 55 | MAKE_FILE_NAME = ../../common/makefile.base 56 | 57 | # include the base makefile 58 | include $(MAKE_FILE_NAME) 59 | -------------------------------------------------------------------------------- /hm-14.0/build/linux/lib/TAppCommon/makefile: -------------------------------------------------------------------------------- 1 | # the SOURCE definiton lets move your makefile to another position 2 | CONFIG = LIBRARY 3 | 4 | # set pathes to the correct directories 5 | SRC_DIR = ../../../../source/Lib/TAppCommon 6 | INC_DIR = ../../../../source/Lib 7 | LIB_DIR = ../../../../lib 8 | BIN_DIR = ../../../../bin 9 | 10 | SRC_DIR1 = 11 | SRC_DIR2 = 12 | SRC_DIR3 = 13 | SRC_DIR4 = 14 | 15 | 16 | USER_INC_DIRS = -I$(SRC_DIR) 17 | USER_LIB_DIRS = 18 | 19 | # intermediate directory for object files 20 | OBJ_DIR = ./objects 21 | 22 | # the library name 23 | PRJ_NAME = TAppCommon 24 | 25 | # version information 26 | MAJOR_VER = 0 27 | MINOR_VER = 1 28 | VER = $(MAJOR_VER).$(MINOR_VER) 29 | 30 | # defines to set 31 | DEFS = -DMSYS_LINUX 32 | 33 | # set objects 34 | OBJS = \ 35 | $(OBJ_DIR)/program_options_lite.o \ 36 | 37 | LIBS = -lpthread 38 | 39 | DEBUG_LIBS = 40 | RELEASE_LIBS = 41 | 42 | STAT_LIBS = 43 | DYN_LIBS = -ldl 44 | 45 | # the libraries to link with 46 | STAT_DEBUG_LIBS = 47 | STAT_RELEASE_LIBS = 48 | DYN_DEBUG_LIBS = 49 | DYN_RELEASE_LIBS = 50 | 51 | # name of the base makefile 52 | MAKE_FILE_NAME = ../../common/makefile.base 53 | 54 | # include the base makefile 55 | include $(MAKE_FILE_NAME) 56 | -------------------------------------------------------------------------------- /hm-14.0/build/linux/lib/TLibCommon/makefile: -------------------------------------------------------------------------------- 1 | # the SOURCE definiton lets move your makefile to another position 2 | CONFIG = LIBRARY 3 | 4 | # set pathes to the correct directories 5 | SRC_DIR = ../../../../source/Lib/TLibCommon 6 | INC_DIR = ../../../../source/Lib 7 | LIB_DIR = ../../../../lib 8 | BIN_DIR = ../../../../bin 9 | 10 | SRC_DIR1 = ../../../../source/Lib/libmd5 11 | SRC_DIR2 = 12 | SRC_DIR3 = 13 | SRC_DIR4 = 14 | 15 | 16 | USER_INC_DIRS = -I$(SRC_DIR) 17 | USER_LIB_DIRS = 18 | 19 | # intermediate directory for object files 20 | OBJ_DIR = ./objects 21 | 22 | # the library name 23 | PRJ_NAME = TLibCommon 24 | 25 | # version information 26 | MAJOR_VER = 0 27 | MINOR_VER = 1 28 | VER = $(MAJOR_VER).$(MINOR_VER) 29 | 30 | # defines to set 31 | DEFS = -DMSYS_LINUX 32 | 33 | # set objects 34 | OBJS = \ 35 | $(OBJ_DIR)/ContextModel.o \ 36 | $(OBJ_DIR)/ContextModel3DBuffer.o \ 37 | $(OBJ_DIR)/SEI.o \ 38 | $(OBJ_DIR)/TComCABACTables.o \ 39 | $(OBJ_DIR)/TComSampleAdaptiveOffset.o \ 40 | $(OBJ_DIR)/TComBitStream.o \ 41 | $(OBJ_DIR)/TComDataCU.o \ 42 | $(OBJ_DIR)/TComLoopFilter.o \ 43 | $(OBJ_DIR)/TComMotionInfo.o \ 44 | $(OBJ_DIR)/TComPattern.o \ 45 | $(OBJ_DIR)/TComPic.o \ 46 | $(OBJ_DIR)/TComPicSym.o \ 47 | $(OBJ_DIR)/TComPicYuv.o \ 48 | $(OBJ_DIR)/TComPicYuvMD5.o \ 49 | $(OBJ_DIR)/TComPrediction.o \ 50 | $(OBJ_DIR)/TComRdCost.o \ 51 | $(OBJ_DIR)/TComRom.o \ 52 | $(OBJ_DIR)/TComSlice.o \ 53 | $(OBJ_DIR)/TComTrQuant.o \ 54 | $(OBJ_DIR)/TComYuv.o \ 55 | $(OBJ_DIR)/TComInterpolationFilter.o \ 56 | $(OBJ_DIR)/libmd5.o \ 57 | $(OBJ_DIR)/TComWeightPrediction.o \ 58 | $(OBJ_DIR)/TComRdCostWeightPrediction.o \ 59 | 60 | LIBS = -lpthread 61 | 62 | DEBUG_LIBS = 63 | RELEASE_LIBS = 64 | 65 | STAT_LIBS = 66 | DYN_LIBS = -ldl 67 | 68 | # the libraries to link with 69 | STAT_DEBUG_LIBS = 70 | STAT_RELEASE_LIBS = 71 | DYN_DEBUG_LIBS = 72 | DYN_RELEASE_LIBS = 73 | 74 | # name of the base makefile 75 | MAKE_FILE_NAME = ../../common/makefile.base 76 | 77 | # include the base makefile 78 | include $(MAKE_FILE_NAME) 79 | -------------------------------------------------------------------------------- /hm-14.0/build/linux/lib/TLibDecoder/makefile: -------------------------------------------------------------------------------- 1 | # the SOURCE definiton lets move your makefile to another position 2 | CONFIG = LIBRARY 3 | 4 | # set pathes to the correct directories 5 | SRC_DIR = ../../../../source/Lib/TLibDecoder 6 | INC_DIR = ../../../../source/Lib 7 | LIB_DIR = ../../../../lib 8 | BIN_DIR = ../../../../bin 9 | 10 | SRC_DIR1 = 11 | SRC_DIR2 = 12 | SRC_DIR3 = 13 | SRC_DIR4 = 14 | 15 | 16 | USER_INC_DIRS = -I$(SRC_DIR) 17 | USER_LIB_DIRS = 18 | 19 | # intermediate directory for object files 20 | OBJ_DIR = ./objects 21 | 22 | # the library name 23 | PRJ_NAME = TLibDecoder 24 | 25 | # version information 26 | MAJOR_VER = 0 27 | MINOR_VER = 1 28 | VER = $(MAJOR_VER).$(MINOR_VER) 29 | 30 | # defines to set 31 | DEFS = -DMSYS_LINUX 32 | 33 | # set objects 34 | OBJS = \ 35 | $(OBJ_DIR)/AnnexBread.o \ 36 | $(OBJ_DIR)/NALread.o \ 37 | $(OBJ_DIR)/SEIread.o \ 38 | $(OBJ_DIR)/SyntaxElementParser.o \ 39 | $(OBJ_DIR)/TDecBinCoderCABAC.o \ 40 | $(OBJ_DIR)/TDecCAVLC.o \ 41 | $(OBJ_DIR)/TDecCu.o \ 42 | $(OBJ_DIR)/TDecEntropy.o \ 43 | $(OBJ_DIR)/TDecGop.o \ 44 | $(OBJ_DIR)/TDecSbac.o \ 45 | $(OBJ_DIR)/TDecSlice.o \ 46 | $(OBJ_DIR)/TDecTop.o \ 47 | 48 | LIBS = -lpthread 49 | 50 | DEBUG_LIBS = 51 | RELEASE_LIBS = 52 | 53 | STAT_LIBS = 54 | DYN_LIBS = -ldl 55 | 56 | # the libraries to link with 57 | STAT_DEBUG_LIBS = 58 | STAT_RELEASE_LIBS = 59 | DYN_DEBUG_LIBS = 60 | DYN_RELEASE_LIBS = 61 | 62 | # name of the base makefile 63 | MAKE_FILE_NAME = ../../common/makefile.base 64 | 65 | # include the base makefile 66 | include $(MAKE_FILE_NAME) 67 | -------------------------------------------------------------------------------- /hm-14.0/build/linux/lib/TLibEncoder/makefile: -------------------------------------------------------------------------------- 1 | # the SOURCE definiton lets move your makefile to another position 2 | CONFIG = LIBRARY 3 | 4 | # set pathes to the correct directories 5 | SRC_DIR = ../../../../source/Lib/TLibEncoder 6 | INC_DIR = ../../../../source/Lib 7 | LIB_DIR = ../../../../lib 8 | BIN_DIR = ../../../../bin 9 | 10 | SRC_DIR1 = 11 | SRC_DIR2 = 12 | SRC_DIR3 = 13 | SRC_DIR4 = 14 | 15 | 16 | USER_INC_DIRS = -I$(SRC_DIR) 17 | USER_LIB_DIRS = 18 | 19 | # intermediate directory for object files 20 | OBJ_DIR = ./objects 21 | 22 | # the library name 23 | PRJ_NAME = TLibEncoder 24 | 25 | # version information 26 | MAJOR_VER = 0 27 | MINOR_VER = 1 28 | VER = $(MAJOR_VER).$(MINOR_VER) 29 | 30 | # defines to set 31 | DEFS = -DMSYS_LINUX 32 | 33 | # set objects 34 | OBJS = \ 35 | $(OBJ_DIR)/NALwrite.o \ 36 | $(OBJ_DIR)/SEIwrite.o \ 37 | $(OBJ_DIR)/SyntaxElementWriter.o \ 38 | $(OBJ_DIR)/TEncBinCoderCABAC.o \ 39 | $(OBJ_DIR)/TEncBinCoderCABACCounter.o \ 40 | $(OBJ_DIR)/TEncSampleAdaptiveOffset.o \ 41 | $(OBJ_DIR)/TEncAnalyze.o \ 42 | $(OBJ_DIR)/TEncCavlc.o \ 43 | $(OBJ_DIR)/TEncCu.o \ 44 | $(OBJ_DIR)/TEncEntropy.o \ 45 | $(OBJ_DIR)/TEncGOP.o \ 46 | $(OBJ_DIR)/TEncSbac.o \ 47 | $(OBJ_DIR)/TEncSearch.o \ 48 | $(OBJ_DIR)/TEncSlice.o \ 49 | $(OBJ_DIR)/TEncTop.o \ 50 | $(OBJ_DIR)/TEncPic.o \ 51 | $(OBJ_DIR)/TEncPreanalyzer.o \ 52 | $(OBJ_DIR)/WeightPredAnalysis.o \ 53 | $(OBJ_DIR)/TEncRateCtrl.o \ 54 | 55 | LIBS = -lpthread 56 | 57 | DEBUG_LIBS = 58 | RELEASE_LIBS = 59 | 60 | STAT_LIBS = 61 | DYN_LIBS = -ldl 62 | 63 | # the libraries to link with 64 | STAT_DEBUG_LIBS = 65 | STAT_RELEASE_LIBS = 66 | DYN_DEBUG_LIBS = 67 | DYN_RELEASE_LIBS = 68 | 69 | # name of the base makefile 70 | MAKE_FILE_NAME = ../../common/makefile.base 71 | 72 | # include the base makefile 73 | include $(MAKE_FILE_NAME) 74 | -------------------------------------------------------------------------------- /hm-14.0/build/linux/lib/TLibVideoIO/makefile: -------------------------------------------------------------------------------- 1 | # the SOURCE definiton lets move your makefile to another position 2 | CONFIG = LIBRARY 3 | 4 | # set pathes to the correct directories 5 | SRC_DIR = ../../../../source/Lib/TLibVideoIO 6 | INC_DIR = ../../../../source/Lib 7 | LIB_DIR = ../../../../lib 8 | BIN_DIR = ../../../../bin 9 | 10 | SRC_DIR1 = 11 | SRC_DIR2 = 12 | SRC_DIR3 = 13 | SRC_DIR4 = 14 | 15 | 16 | USER_INC_DIRS = -I$(SRC_DIR) 17 | USER_LIB_DIRS = 18 | 19 | # intermediate directory for object files 20 | OBJ_DIR = ./objects 21 | 22 | # the library name 23 | PRJ_NAME = TLibVideoIO 24 | 25 | # version information 26 | MAJOR_VER = 0 27 | MINOR_VER = 28 28 | VER = $(MAJOR_VER).$(MINOR_VER) 29 | 30 | # defines to set 31 | DEFS = -DMSYS_LINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DMSYS_UNIX_LARGEFILE 32 | 33 | # set objects 34 | OBJS = \ 35 | $(OBJ_DIR)/TVideoIOYuv.o \ 36 | 37 | 38 | LIBS = -lpthread 39 | 40 | DEBUG_LIBS = 41 | RELEASE_LIBS = 42 | 43 | STAT_LIBS = 44 | DYN_LIBS = 45 | 46 | # the libraries to link with 47 | STAT_DEBUG_LIBS = 48 | STAT_RELEASE_LIBS = 49 | DYN_DEBUG_LIBS = 50 | DYN_RELEASE_LIBS = 51 | 52 | # name of the base makefile 53 | MAKE_FILE_NAME = ../../common/makefile.base 54 | 55 | # include the base makefile 56 | include $(MAKE_FILE_NAME) 57 | -------------------------------------------------------------------------------- /hm-14.0/build/linux/makefile: -------------------------------------------------------------------------------- 1 | ### enforce 32-bit build : 1=yes, 0=no 2 | M32?= 0 3 | 4 | export M32 5 | 6 | all: 7 | $(MAKE) -C lib/TLibVideoIO MM32=$(M32) 8 | $(MAKE) -C lib/TLibCommon MM32=$(M32) 9 | $(MAKE) -C lib/TLibDecoder MM32=$(M32) 10 | $(MAKE) -C lib/TLibEncoder MM32=$(M32) 11 | $(MAKE) -C lib/TAppCommon MM32=$(M32) 12 | $(MAKE) -C app/TAppDecoder MM32=$(M32) 13 | $(MAKE) -C app/TAppEncoder MM32=$(M32) 14 | $(MAKE) -C utils/annexBbytecount MM32=$(M32) 15 | $(MAKE) -C utils/convert_NtoMbit_YCbCr MM32=$(M32) 16 | 17 | debug: 18 | $(MAKE) -C lib/TLibVideoIO debug MM32=$(M32) 19 | $(MAKE) -C lib/TLibCommon debug MM32=$(M32) 20 | $(MAKE) -C lib/TLibDecoder debug MM32=$(M32) 21 | $(MAKE) -C lib/TLibEncoder debug MM32=$(M32) 22 | $(MAKE) -C lib/TAppCommon debug MM32=$(M32) 23 | $(MAKE) -C app/TAppDecoder debug MM32=$(M32) 24 | $(MAKE) -C app/TAppEncoder debug MM32=$(M32) 25 | $(MAKE) -C utils/annexBbytecount debug MM32=$(M32) 26 | $(MAKE) -C utils/convert_NtoMbit_YCbCr debug MM32=$(M32) 27 | 28 | release: 29 | $(MAKE) -C lib/TLibVideoIO release MM32=$(M32) 30 | $(MAKE) -C lib/TLibCommon release MM32=$(M32) 31 | $(MAKE) -C lib/TLibDecoder release MM32=$(M32) 32 | $(MAKE) -C lib/TLibEncoder release MM32=$(M32) 33 | $(MAKE) -C lib/TAppCommon release MM32=$(M32) 34 | $(MAKE) -C app/TAppDecoder release MM32=$(M32) 35 | $(MAKE) -C app/TAppEncoder release MM32=$(M32) 36 | $(MAKE) -C utils/annexBbytecount release MM32=$(M32) 37 | $(MAKE) -C utils/convert_NtoMbit_YCbCr release MM32=$(M32) 38 | 39 | clean: 40 | $(MAKE) -C lib/TLibVideoIO clean MM32=$(M32) 41 | $(MAKE) -C lib/TLibCommon clean MM32=$(M32) 42 | $(MAKE) -C lib/TLibDecoder clean MM32=$(M32) 43 | $(MAKE) -C lib/TLibEncoder clean MM32=$(M32) 44 | $(MAKE) -C lib/TAppCommon clean MM32=$(M32) 45 | $(MAKE) -C app/TAppDecoder clean MM32=$(M32) 46 | $(MAKE) -C app/TAppEncoder clean MM32=$(M32) 47 | $(MAKE) -C utils/annexBbytecount clean MM32=$(M32) 48 | $(MAKE) -C utils/convert_NtoMbit_YCbCr clean MM32=$(M32) 49 | -------------------------------------------------------------------------------- /hm-14.0/build/linux/utils/annexBbytecount/makefile: -------------------------------------------------------------------------------- 1 | # the SOURCE definiton lets you move your makefile to another position 2 | CONFIG = CONSOLE 3 | 4 | # set directories to your wanted values 5 | SRC_DIR = ../../../../source/App/utils 6 | INC_DIR = ../../../../source/Lib 7 | LIB_DIR = ../../../../lib 8 | BIN_DIR = ../../../../bin 9 | 10 | SRC_DIR1 = 11 | SRC_DIR2 = 12 | SRC_DIR3 = 13 | SRC_DIR4 = 14 | 15 | USER_INC_DIRS = -I$(SRC_DIR) 16 | USER_LIB_DIRS = 17 | 18 | # intermediate directory for object files 19 | OBJ_DIR = ./objects 20 | 21 | # set executable name 22 | PRJ_NAME = annexBbytecount 23 | 24 | # defines to set 25 | DEFS = -DMSYS_LINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DMSYS_UNIX_LARGEFILE 26 | 27 | # set objects 28 | OBJS = \ 29 | $(OBJ_DIR)/annexBbytecount.o \ 30 | 31 | # set libs to link with 32 | LIBS = -ldl 33 | 34 | DEBUG_LIBS = 35 | RELEASE_LIBS = 36 | 37 | STAT_LIBS = -lpthread 38 | DYN_LIBS = 39 | 40 | 41 | DYN_DEBUG_LIBS = -lTLibDecoderd -lTLibCommond -lTLibVideoIOd -lTAppCommond 42 | DYN_DEBUG_PREREQS = $(LIB_DIR)/libTLibDecoderd.a $(LIB_DIR)/libTLibCommond.a $(LIB_DIR)/libTLibVideoIOd.a $(LIB_DIR)/libTAppCommond.a 43 | STAT_DEBUG_LIBS = -lTLibDecoderStaticd -lTLibCommonStaticd -lTLibVideoIOStaticd -lTAppCommonStaticd 44 | STAT_DEBUG_PREREQS = $(LIB_DIR)/libTLibDecoderStaticd.a $(LIB_DIR)/libTLibCommonStaticd.a $(LIB_DIR)/libTLibVideoIOStaticd.a $(LIB_DIR)/libTAppCommonStaticd.a 45 | 46 | DYN_RELEASE_LIBS = -lTLibDecoder -lTLibCommon -lTLibVideoIO -lTAppCommon 47 | DYN_RELEASE_PREREQS = $(LIB_DIR)/libTLibDecoder.a $(LIB_DIR)/libTLibCommon.a $(LIB_DIR)/libTLibVideoIO.a $(LIB_DIR)/libTAppCommon.a 48 | STAT_RELEASE_LIBS = -lTLibDecoderStatic -lTLibCommonStatic -lTLibVideoIOStatic -lTAppCommonStatic 49 | STAT_RELEASE_PREREQS = $(LIB_DIR)/libTLibDecoderStatic.a $(LIB_DIR)/libTLibCommonStatic.a $(LIB_DIR)/libTLibVideoIOStatic.a $(LIB_DIR)/libTAppCommonStatic.a 50 | 51 | 52 | # name of the base makefile 53 | MAKE_FILE_NAME = ../../common/makefile.base 54 | 55 | # include the base makefile 56 | include $(MAKE_FILE_NAME) 57 | -------------------------------------------------------------------------------- /hm-14.0/build/linux/utils/convert_NtoMbit_YCbCr/makefile: -------------------------------------------------------------------------------- 1 | # the SOURCE definiton lets you move your makefile to another position 2 | CONFIG = CONSOLE 3 | 4 | # set directories to your wanted values 5 | SRC_DIR = ../../../../source/App/utils 6 | INC_DIR = ../../../../source/Lib 7 | LIB_DIR = ../../../../lib 8 | BIN_DIR = ../../../../bin 9 | 10 | SRC_DIR1 = 11 | SRC_DIR2 = 12 | SRC_DIR3 = 13 | SRC_DIR4 = 14 | 15 | USER_INC_DIRS = -I$(SRC_DIR) 16 | USER_LIB_DIRS = 17 | 18 | # intermediate directory for object files 19 | OBJ_DIR = ./objects 20 | 21 | # set executable name 22 | PRJ_NAME = convert_NtoMbit_YCbCr 23 | 24 | # defines to set 25 | DEFS = -DMSYS_LINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DMSYS_UNIX_LARGEFILE 26 | 27 | # set objects 28 | OBJS = \ 29 | $(OBJ_DIR)/convert_NtoMbit_YCbCr.o \ 30 | 31 | # set libs to link with 32 | LIBS = -ldl 33 | 34 | DEBUG_LIBS = 35 | RELEASE_LIBS = 36 | 37 | STAT_LIBS = -lpthread 38 | DYN_LIBS = 39 | 40 | 41 | DYN_DEBUG_LIBS = -lTLibDecoderd -lTLibCommond -lTLibVideoIOd -lTAppCommond 42 | DYN_DEBUG_PREREQS = $(LIB_DIR)/libTLibDecoderd.a $(LIB_DIR)/libTLibCommond.a $(LIB_DIR)/libTLibVideoIOd.a $(LIB_DIR)/libTAppCommond.a 43 | STAT_DEBUG_LIBS = -lTLibDecoderStaticd -lTLibCommonStaticd -lTLibVideoIOStaticd -lTAppCommonStaticd 44 | STAT_DEBUG_PREREQS = $(LIB_DIR)/libTLibDecoderStaticd.a $(LIB_DIR)/libTLibCommonStaticd.a $(LIB_DIR)/libTLibVideoIOStaticd.a $(LIB_DIR)/libTAppCommonStaticd.a 45 | 46 | DYN_RELEASE_LIBS = -lTLibDecoder -lTLibCommon -lTLibVideoIO -lTAppCommon 47 | DYN_RELEASE_PREREQS = $(LIB_DIR)/libTLibDecoder.a $(LIB_DIR)/libTLibCommon.a $(LIB_DIR)/libTLibVideoIO.a $(LIB_DIR)/libTAppCommon.a 48 | STAT_RELEASE_LIBS = -lTLibDecoderStatic -lTLibCommonStatic -lTLibVideoIOStatic -lTAppCommonStatic 49 | STAT_RELEASE_PREREQS = $(LIB_DIR)/libTLibDecoderStatic.a $(LIB_DIR)/libTLibCommonStatic.a $(LIB_DIR)/libTLibVideoIOStatic.a $(LIB_DIR)/libTAppCommonStatic.a 50 | 51 | 52 | # name of the base makefile 53 | MAKE_FILE_NAME = ../../common/makefile.base 54 | 55 | # include the base makefile 56 | include $(MAKE_FILE_NAME) 57 | -------------------------------------------------------------------------------- /hm-14.0/build/vc10/TAppCommon_vc10.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {fb1894c4-d37c-4d7b-b852-ccd81dc75384} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {ffdca758-d453-4e59-857a-f84074ede5ba} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | 19 | 20 | Header Files 21 | 22 | 23 | -------------------------------------------------------------------------------- /hm-14.0/build/vc10/TAppDecoder_vc10.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {1aa8b291-7006-406d-b440-8af60fbc9eb5} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {5e50c4f1-0ca1-47af-8104-45cc6d910254} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {ff0d9379-b34f-4787-8951-1e06360f58a4} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | 29 | 30 | Header Files 31 | 32 | 33 | Header Files 34 | 35 | 36 | -------------------------------------------------------------------------------- /hm-14.0/build/vc10/TAppEncoder_vc10.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {e7545260-6a63-49d7-a40f-c50ca7f27a4b} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {45205fc1-f025-43cb-ac9f-2f6b288020ab} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {22b56140-f05f-49ef-93df-2b61ddd76211} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | 29 | 30 | Header Files 31 | 32 | 33 | Header Files 34 | 35 | 36 | -------------------------------------------------------------------------------- /hm-14.0/build/vc10/TLibDecoder_vc10.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {744fcd72-a655-425f-bb39-3ab96fb48035} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {714796a5-11ae-4ebd-b4ad-0b93c44f8cfc} 10 | h;hpp;hxx;hm;inl 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | Source Files 46 | 47 | 48 | Source Files 49 | 50 | 51 | 52 | 53 | Header Files 54 | 55 | 56 | Header Files 57 | 58 | 59 | Header Files 60 | 61 | 62 | Header Files 63 | 64 | 65 | Header Files 66 | 67 | 68 | Header Files 69 | 70 | 71 | Header Files 72 | 73 | 74 | Header Files 75 | 76 | 77 | Header Files 78 | 79 | 80 | Header Files 81 | 82 | 83 | Header Files 84 | 85 | 86 | Header Files 87 | 88 | 89 | Header Files 90 | 91 | 92 | -------------------------------------------------------------------------------- /hm-14.0/build/vc10/TLibVideoIO_vc10.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {6deae16b-79a7-4141-88d0-fb015f23f586} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {62ba4b7c-b50d-4cba-abba-51619954bc1e} 10 | h;hpp;hxx;hm;inl 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | 19 | 20 | Header Files 21 | 22 | 23 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/BQMall.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/BQMall_832x480_60.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 60 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 832 # Input frame width 7 | SourceHeight : 480 # Input frame height 8 | FramesToBeEncoded : 600 # Number of frames to be coded 9 | 10 | Level : 3.1 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/BQSquare.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/BQSquare_416x240_60.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 60 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 416 # Input frame width 7 | SourceHeight : 240 # Input frame height 8 | FramesToBeEncoded : 600 # Number of frames to be coded 9 | 10 | Level : 2.1 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/BQTerrace.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/BQTerrace_1920x1080_60.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 60 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 1920 # Input frame width 7 | SourceHeight : 1080 # Input frame height 8 | FramesToBeEncoded : 600 # Number of frames to be coded 9 | 10 | Level : 4.1 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/BasketballDrill.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/BasketballDrill_832x480_50.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 50 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 832 # Input frame width 7 | SourceHeight : 480 # Input frame height 8 | FramesToBeEncoded : 500 # Number of frames to be coded 9 | 10 | Level : 3.1 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/BasketballDrillText.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : BasketballDrillText_832x480_50.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 50 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 832 # Input frame width 7 | SourceHeight : 480 # Input frame height 8 | FramesToBeEncoded : 500 # Number of frames to be coded 9 | 10 | Level : 3.1 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/BasketballDrive.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/BasketballDrive_1920x1080_50.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 50 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 1920 # Input frame width 7 | SourceHeight : 1080 # Input frame height 8 | FramesToBeEncoded : 500 # Number of frames to be coded 9 | 10 | Level : 4.1 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/BasketballPass.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/BasketballPass_416x240_50.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 50 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 416 # Input frame width 7 | SourceHeight : 240 # Input frame height 8 | FramesToBeEncoded : 500 # Number of frames to be coded 9 | 10 | Level : 2.1 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/BlowingBubbles.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/BlowingBubbles_416x240_50.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 50 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 416 # Input frame width 7 | SourceHeight : 240 # Input frame height 8 | FramesToBeEncoded : 500 # Number of frames to be coded 9 | 10 | Level : 2.1 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/Cactus.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/Cactus_1920x1080_50.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 50 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 1920 # Input frame width 7 | SourceHeight : 1080 # Input frame height 8 | FramesToBeEncoded : 500 # Number of frames to be coded 9 | 10 | Level : 4.1 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/ChinaSpeed.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ChinaSpeed_1024x768_30.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 30 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 1024 # Input frame width 7 | SourceHeight : 768 # Input frame height 8 | FramesToBeEncoded : 500 # Number of frames to be coded 9 | 10 | Level : 3.1 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/FourPeople.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/FourPeople_1280x720_60.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 60 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 1280 # Input frame width 7 | SourceHeight : 720 # Input frame height 8 | FramesToBeEncoded : 600 # Number of frames to be coded 9 | 10 | Level : 4 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/Johnny.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/Johnny_1280x720_60.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 60 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 1280 # Input frame width 7 | SourceHeight : 720 # Input frame height 8 | FramesToBeEncoded : 600 # Number of frames to be coded 9 | 10 | Level : 4 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/Kimono.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/Kimono1_1920x1080_24.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 24 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 1920 # Input frame width 7 | SourceHeight : 1080 # Input frame height 8 | FramesToBeEncoded : 240 # Number of frames to be coded 9 | 10 | Level : 4 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/KristenAndSara.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/KristenAndSara_1280x720_60.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 60 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 1280 # Input frame width 7 | SourceHeight : 720 # Input frame height 8 | FramesToBeEncoded : 600 # Number of frames to be coded 9 | 10 | Level : 4 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/NebutaFestival_10bit.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : NebutaFestival_2560x1600_60_10bit_crop.yuv 3 | InputBitDepth : 10 # Input bitdepth 4 | FrameRate : 60 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 2560 # Input frame width 7 | SourceHeight : 1600 # Input frame height 8 | FramesToBeEncoded : 300 # Number of frames to be coded 9 | 10 | Level : 5 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/ParkScene.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/ParkScene_1920x1080_24.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 24 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 1920 # Input frame width 7 | SourceHeight : 1080 # Input frame height 8 | FramesToBeEncoded : 240 # Number of frames to be coded 9 | 10 | Level : 4 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/PartyScene.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/PartyScene_832x480_50.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 50 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 832 # Input frame width 7 | SourceHeight : 480 # Input frame height 8 | FramesToBeEncoded : 500 # Number of frames to be coded 9 | 10 | Level : 3.1 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/PeopleOnStreet.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/PeopleOnStreet_2560x1600_30_crop.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 30 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 2560 # Input frame width 7 | SourceHeight : 1600 # Input frame height 8 | FramesToBeEncoded : 150 # Number of frames to be coded 9 | 10 | Level : 5 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/RaceHorses.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/RaceHorses_416x240_30.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 30 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 416 # Input frame width 7 | SourceHeight : 240 # Input frame height 8 | FramesToBeEncoded : 300 # Number of frames to be coded 9 | 10 | Level : 2 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/RaceHorsesC.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/RaceHorses_832x480_30.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 30 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 832 # Input frame width 7 | SourceHeight : 480 # Input frame height 8 | FramesToBeEncoded : 300 # Number of frames to be coded 9 | 10 | Level : 3 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/SlideEditing.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : SlideEditing_1280x720_30.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 30 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 1280 # Input frame width 7 | SourceHeight : 720 # Input frame height 8 | FramesToBeEncoded : 300 # Number of frames to be coded 9 | 10 | Level : 3.1 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/SlideShow.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : SlideShow_1280x720_20.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 20 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 1280 # Input frame width 7 | SourceHeight : 720 # Input frame height 8 | FramesToBeEncoded : 500 # Number of frames to be coded 9 | 10 | Level : 3.1 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/SteamLocomotiveTrain_10bit.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : SteamLocomotiveTrain_2560x1600_60_10bit_crop.yuv 3 | InputBitDepth : 10 # Input bitdepth 4 | FrameRate : 60 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 2560 # Input frame width 7 | SourceHeight : 1600 # Input frame height 8 | FramesToBeEncoded : 300 # Number of frames to be coded 9 | 10 | Level : 5 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/Traffic.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/Traffic_2560x1600_30_crop.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 30 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 2560 # Input frame width 7 | SourceHeight : 1600 # Input frame height 8 | FramesToBeEncoded : 150 # Number of frames to be coded 9 | 10 | Level : 5 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/Vidyo1.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/vidyo1_1280x720_60.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 60 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 1280 # Input frame width 7 | SourceHeight : 720 # Input frame height 8 | FramesToBeEncoded : 600 # Number of frames to be coded 9 | 10 | Level : 4 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/Vidyo3.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/vidyo3_1280x720_60.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 60 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 1280 # Input frame width 7 | SourceHeight : 720 # Input frame height 8 | FramesToBeEncoded : 600 # Number of frames to be coded 9 | 10 | Level : 4 11 | -------------------------------------------------------------------------------- /hm-14.0/cfg/per-sequence/Vidyo4.cfg: -------------------------------------------------------------------------------- 1 | #======== File I/O =============== 2 | InputFile : ../../origCfP/vidyo4_1280x720_60.yuv 3 | InputBitDepth : 8 # Input bitdepth 4 | FrameRate : 60 # Frame Rate per second 5 | FrameSkip : 0 # Number of frames to be skipped in input 6 | SourceWidth : 1280 # Input frame width 7 | SourceHeight : 720 # Input frame height 8 | FramesToBeEncoded : 600 # Number of frames to be coded 9 | 10 | Level : 4 11 | -------------------------------------------------------------------------------- /hm-14.0/compat/msvc/stdint.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /* a minimal set of C99 types for use with MSVC */ 4 | 5 | typedef signed char int8_t; 6 | typedef short int int16_t; 7 | typedef int int32_t; 8 | typedef __int64 int64_t; 9 | 10 | typedef unsigned char uint8_t; 11 | typedef unsigned short int uint16_t; 12 | typedef unsigned int uint32_t; 13 | typedef unsigned __int64 uint64_t; 14 | -------------------------------------------------------------------------------- /hm-14.0/doc/Makefile: -------------------------------------------------------------------------------- 1 | SHELL=/bin/bash 2 | 3 | DOCNUM:=software-manual 4 | 5 | LATEX:=$(shell which xelatex || which pdflatex || which latex) 6 | BIBTOOL:=$(shell which bibtool || echo \\\# skipping bibtool ) 7 | BIBTOOL_DB=~/mpeg/doc/bib/jctvc.bib 8 | 9 | all: $(DOCNUM).pdf 10 | 11 | %.aux: %.tex 12 | $(LATEX) $(LATEXFLAGS) $< 13 | 14 | %.bib: %.tex %.aux 15 | $(BIBTOOL) -q -s -d -r <(echo check.double.delete = ON) -i $(BIBTOOL_DB) -x $(*F).aux -o $@ 16 | touch $@ 17 | 18 | %.bbl: %.tex %.aux %.bib 19 | -bibtex $(*F) 20 | 21 | ifneq ($(LATEX),latex) 22 | %.pdf: %.tex %.bbl 23 | $(LATEX) $(LATEXFLAGS) $< 24 | $(LATEX) $(LATEXFLAGS) $< 25 | endif 26 | 27 | %.pdf: %.dvi 28 | dvipdfm $*.dvi 29 | 30 | %.dvi: %.tex %.bbl 31 | $(LATEX) $(LATEXFLAGS) $< 32 | $(LATEX) $(LATEXFLAGS) $< 33 | 34 | $(DOCNUM)-diff_%.pdf: LATEXFLAGS=--interaction=batchmode 35 | $(DOCNUM)-diff_%.tex: 36 | -latexdiff-vc --exclude-safecmd=textbf --append-context1cmd=subfloat --append-context2cmd=multicolumn --encoding=utf8 --force --git -r $* $(DOCNUM).tex 37 | -------------------------------------------------------------------------------- /hm-14.0/doc/README_data-structure.ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hmchen-github/iterative-filtering-intra-prediction/62732d4c32512f6db600b963fde9e1fe5fbe2b99/hm-14.0/doc/README_data-structure.ppt -------------------------------------------------------------------------------- /hm-14.0/doc/README_software-manual.txt: -------------------------------------------------------------------------------- 1 | Software manual instructions 2 | ============================ 3 | The software manual is written in plain text using LaTeX markup. 4 | 5 | Prerequisites 6 | ------------- 7 | The following tools are required to render the document: 8 | - LaTeX 9 | - JCT-VC document template 10 | 11 | The document uses the JCT-VC report class/template, available from: 12 | http://hevc.kw.bbc.co.uk/git/w/jctvc-latex.git 13 | 14 | To install this, either -- 15 | a) export the environment variable TEXINPUTS=path/to/jctvc-latex/:: 16 | b) copy jctvcdoc.cls to this directory. 17 | 18 | NB, if performing (b), please do not commit the jctvcdoc.cls file. 19 | 20 | Building 21 | -------- 22 | A makefile is provided that will render a pdf from the LaTeX source. 23 | If LaTeX is installed, typing "make" ought to be sufficient. 24 | 25 | Please do not commit updated PDFs to the SVN repository, this will be 26 | performed by the Software AHG prior to making an HM release. 27 | 28 | If there are any issues with the building the document or formatting 29 | the LaTeX source, please contact David Flynn . 30 | -------------------------------------------------------------------------------- /hm-14.0/doc/gop-structure-example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hmchen-github/iterative-filtering-intra-prediction/62732d4c32512f6db600b963fde9e1fe5fbe2b99/hm-14.0/doc/gop-structure-example.pdf -------------------------------------------------------------------------------- /hm-14.0/doc/mainpage.h: -------------------------------------------------------------------------------- 1 | #include "TLibCommon/CommonDef.h" 2 | 3 | /** 4 | * \file mainpage.h 5 | * \brief HEVC reference documentation main page (no functional use) 6 | * \mainpage 7 | * 8 | * \section Introduction 9 | * 10 | * This is the doxygen generated documentation of the HEVC HM reference software. 11 | * 12 | * For detailed information see the sub-pages of this site. 13 | * 14 | * For information on the subversion repositories and the software manual see 15 | * http://hevc.hhi.fraunhofer.de 16 | * 17 | * For bug reporting and known issues see: 18 | * http://hevc.kw.bbc.co.uk/trac/ 19 | * 20 | * \section License 21 | * 22 | * The copyright in this software is being made available under the BSD 23 | * License, included below. This software may be subject to other third party 24 | * and contributor rights, including patent rights, and no such rights are 25 | * granted under this license. 26 | * 27 | * Copyright (c) 2010-2014, ITU/ISO/IEC 28 | * All rights reserved. 29 | * 30 | * Redistribution and use in source and binary forms, with or without 31 | * modification, are permitted provided that the following conditions are met: 32 | * 33 | * - Redistributions of source code must retain the above copyright notice, 34 | * this list of conditions and the following disclaimer. 35 | * - Redistributions in binary form must reproduce the above copyright notice, 36 | * this list of conditions and the following disclaimer in the documentation 37 | * and/or other materials provided with the distribution. 38 | * - Neither the name of the ITU/ISO/IEC nor the names of its contributors may 39 | * be used to endorse or promote products derived from this software without 40 | * specific prior written permission. 41 | * 42 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 43 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 44 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 45 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 46 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 47 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 48 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 49 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 50 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 51 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 52 | * THE POSSIBILITY OF SUCH DAMAGE. 53 | * 54 | * \note 55 | * This document is automatically generated from the source code and special documentation tags. 56 | * For more details on the used documentation system see http://www.doxygen.org 57 | * 58 | * \defgroup TLibCommon TLibCommon - Library containing functionality that is shared between encoder and decoder 59 | * \defgroup TLibEncoder TLibEncoder - Library containing encoder functionality 60 | * \defgroup TLibDecoder TLibDecoder - Library containing encoder functionality 61 | * \defgroup libMD5 libMD5 - MD5 helper functions 62 | * \defgroup TAppCommon TAppCommon - Application support library 63 | * \defgroup TAppEncoder TAppEncoder - Encoder application 64 | * \defgroup TAppDecoder TAppDecoder - Decoder application 65 | */ 66 | -------------------------------------------------------------------------------- /hm-14.0/doc/software-manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hmchen-github/iterative-filtering-intra-prediction/62732d4c32512f6db600b963fde9e1fe5fbe2b99/hm-14.0/doc/software-manual.pdf -------------------------------------------------------------------------------- /hm-14.0/source/App/TAppDecoder/TAppDecCfg.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TAppDecCfg.h 35 | \brief Decoder configuration class (header) 36 | */ 37 | 38 | #ifndef __TAPPDECCFG__ 39 | #define __TAPPDECCFG__ 40 | 41 | #if _MSC_VER > 1000 42 | #pragma once 43 | #endif // _MSC_VER > 1000 44 | 45 | #include "TLibCommon/CommonDef.h" 46 | #include 47 | 48 | //! \ingroup TAppDecoder 49 | //! \{ 50 | 51 | // ==================================================================================================================== 52 | // Class definition 53 | // ==================================================================================================================== 54 | 55 | /// Decoder configuration class 56 | class TAppDecCfg 57 | { 58 | protected: 59 | Char* m_pchBitstreamFile; ///< input bitstream file name 60 | Char* m_pchReconFile; ///< output reconstruction file name 61 | Int m_iSkipFrame; ///< counter for frames prior to the random access point to skip 62 | Int m_outputBitDepthY; ///< bit depth used for writing output (luma) 63 | Int m_outputBitDepthC; ///< bit depth used for writing output (chroma)t 64 | 65 | Int m_iMaxTemporalLayer; ///< maximum temporal layer to be decoded 66 | Int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message 67 | 68 | std::vector m_targetDecLayerIdSet; ///< set of LayerIds to be included in the sub-bitstream extraction process. 69 | Int m_respectDefDispWindow; ///< Only output content inside the default display window 70 | 71 | public: 72 | TAppDecCfg() 73 | : m_pchBitstreamFile(NULL) 74 | , m_pchReconFile(NULL) 75 | , m_iSkipFrame(0) 76 | , m_outputBitDepthY(0) 77 | , m_outputBitDepthC(0) 78 | , m_iMaxTemporalLayer(-1) 79 | , m_decodedPictureHashSEIEnabled(0) 80 | , m_respectDefDispWindow(0) 81 | {} 82 | virtual ~TAppDecCfg() {} 83 | 84 | Bool parseCfg ( Int argc, Char* argv[] ); ///< initialize option class from configuration 85 | }; 86 | 87 | //! \} 88 | 89 | #endif 90 | 91 | 92 | -------------------------------------------------------------------------------- /hm-14.0/source/App/TAppDecoder/TAppDecTop.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TAppDecTop.h 35 | \brief Decoder application class (header) 36 | */ 37 | 38 | #ifndef __TAPPDECTOP__ 39 | #define __TAPPDECTOP__ 40 | 41 | #if _MSC_VER > 1000 42 | #pragma once 43 | #endif // _MSC_VER > 1000 44 | 45 | #include "TLibVideoIO/TVideoIOYuv.h" 46 | #include "TLibCommon/TComList.h" 47 | #include "TLibCommon/TComPicYuv.h" 48 | #include "TLibDecoder/TDecTop.h" 49 | #include "TAppDecCfg.h" 50 | 51 | //! \ingroup TAppDecoder 52 | //! \{ 53 | 54 | // ==================================================================================================================== 55 | // Class definition 56 | // ==================================================================================================================== 57 | 58 | /// decoder application class 59 | class TAppDecTop : public TAppDecCfg 60 | { 61 | private: 62 | // class interface 63 | TDecTop m_cTDecTop; ///< decoder class 64 | TVideoIOYuv m_cTVideoIOYuvReconFile; ///< reconstruction YUV class 65 | 66 | // for output control 67 | Int m_iPOCLastDisplay; ///< last POC in display order 68 | 69 | public: 70 | TAppDecTop(); 71 | virtual ~TAppDecTop() {} 72 | 73 | Void create (); ///< create internal members 74 | Void destroy (); ///< destroy internal members 75 | Void decode (); ///< main decoding function 76 | 77 | protected: 78 | Void xCreateDecLib (); ///< create internal classes 79 | Void xDestroyDecLib (); ///< destroy internal classes 80 | Void xInitDecLib (); ///< initialize decoder class 81 | 82 | Void xWriteOutput ( TComList* pcListPic , UInt tId); ///< write YUV to file 83 | Void xFlushOutput ( TComList* pcListPic ); ///< flush all remaining decoded pictures to file 84 | Bool isNaluWithinTargetDecLayerIdSet ( InputNALUnit* nalu ); ///< check whether given Nalu is within targetDecLayerIdSet 85 | }; 86 | 87 | //! \} 88 | 89 | #endif 90 | 91 | -------------------------------------------------------------------------------- /hm-14.0/source/App/TAppDecoder/decmain.cpp: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file decmain.cpp 35 | \brief Decoder application main 36 | */ 37 | 38 | #include 39 | #include 40 | #include 41 | #include "TAppDecTop.h" 42 | 43 | //! \ingroup TAppDecoder 44 | //! \{ 45 | 46 | bool g_md5_mismatch = false; ///< top level flag that indicates if there has been a decoding mismatch 47 | 48 | // ==================================================================================================================== 49 | // Main function 50 | // ==================================================================================================================== 51 | 52 | int main(int argc, char* argv[]) 53 | { 54 | TAppDecTop cTAppDecTop; 55 | 56 | // print information 57 | fprintf( stdout, "\n" ); 58 | fprintf( stdout, "HM software: Decoder Version [%s]", NV_VERSION ); 59 | fprintf( stdout, NVM_ONOS ); 60 | fprintf( stdout, NVM_COMPILEDBY ); 61 | fprintf( stdout, NVM_BITS ); 62 | fprintf( stdout, "\n" ); 63 | 64 | // create application decoder class 65 | cTAppDecTop.create(); 66 | 67 | // parse configuration 68 | if(!cTAppDecTop.parseCfg( argc, argv )) 69 | { 70 | cTAppDecTop.destroy(); 71 | return 1; 72 | } 73 | 74 | // starting time 75 | double dResult; 76 | long lBefore = clock(); 77 | 78 | // call decoding function 79 | cTAppDecTop.decode(); 80 | 81 | if (g_md5_mismatch) 82 | { 83 | printf("\n\n***ERROR*** A decoding mismatch occured: signalled md5sum does not match\n"); 84 | } 85 | 86 | // ending time 87 | dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC; 88 | printf("\n Total Time: %12.3f sec.\n", dResult); 89 | 90 | // destroy application decoder class 91 | cTAppDecTop.destroy(); 92 | 93 | return g_md5_mismatch ? EXIT_FAILURE : EXIT_SUCCESS; 94 | } 95 | 96 | //! \} 97 | -------------------------------------------------------------------------------- /hm-14.0/source/App/TAppEncoder/TAppEncTop.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TAppEncTop.h 35 | \brief Encoder application class (header) 36 | */ 37 | 38 | #ifndef __TAPPENCTOP__ 39 | #define __TAPPENCTOP__ 40 | 41 | #include 42 | #include 43 | 44 | #include "TLibEncoder/TEncTop.h" 45 | #include "TLibVideoIO/TVideoIOYuv.h" 46 | #include "TLibCommon/AccessUnit.h" 47 | #include "TAppEncCfg.h" 48 | 49 | //! \ingroup TAppEncoder 50 | //! \{ 51 | 52 | // ==================================================================================================================== 53 | // Class definition 54 | // ==================================================================================================================== 55 | 56 | /// encoder application class 57 | class TAppEncTop : public TAppEncCfg 58 | { 59 | private: 60 | // class interface 61 | TEncTop m_cTEncTop; ///< encoder class 62 | TVideoIOYuv m_cTVideoIOYuvInputFile; ///< input YUV file 63 | TVideoIOYuv m_cTVideoIOYuvReconFile; ///< output reconstruction file 64 | 65 | TComList m_cListPicYuvRec; ///< list of reconstruction YUV files 66 | 67 | Int m_iFrameRcvd; ///< number of received frames 68 | 69 | UInt m_essentialBytes; 70 | UInt m_totalBytes; 71 | protected: 72 | // initialization 73 | Void xCreateLib (); ///< create files & encoder class 74 | Void xInitLibCfg (); ///< initialize internal variables 75 | Void xInitLib (Bool isFieldCoding); ///< initialize encoder class 76 | Void xDestroyLib (); ///< destroy encoder class 77 | 78 | /// obtain required buffers 79 | Void xGetBuffer(TComPicYuv*& rpcPicYuvRec); 80 | 81 | /// delete allocated buffers 82 | Void xDeleteBuffer (); 83 | 84 | // file I/O 85 | Void xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list& accessUnits); ///< write bitstream to file 86 | void rateStatsAccum(const AccessUnit& au, const std::vector& stats); 87 | void printRateSummary(); 88 | 89 | public: 90 | TAppEncTop(); 91 | virtual ~TAppEncTop(); 92 | 93 | Void encode (); ///< main encoding function 94 | TEncTop& getTEncTop () { return m_cTEncTop; } ///< return encoder class pointer reference 95 | };// END CLASS DEFINITION TAppEncTop 96 | 97 | //! \} 98 | 99 | #endif // __TAPPENCTOP__ 100 | 101 | -------------------------------------------------------------------------------- /hm-14.0/source/App/TAppEncoder/encmain.cpp: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file encmain.cpp 35 | \brief Encoder application main 36 | */ 37 | 38 | #include 39 | #include 40 | #include "TAppEncTop.h" 41 | #include "TAppCommon/program_options_lite.h" 42 | 43 | using namespace std; 44 | namespace po = df::program_options_lite; 45 | 46 | //! \ingroup TAppEncoder 47 | //! \{ 48 | 49 | // ==================================================================================================================== 50 | // Main function 51 | // ==================================================================================================================== 52 | 53 | int main(int argc, char* argv[]) 54 | { 55 | TAppEncTop cTAppEncTop; 56 | 57 | // print information 58 | fprintf( stdout, "\n" ); 59 | fprintf( stdout, "HM software: Encoder Version [%s]", NV_VERSION ); 60 | fprintf( stdout, NVM_ONOS ); 61 | fprintf( stdout, NVM_COMPILEDBY ); 62 | fprintf( stdout, NVM_BITS ); 63 | fprintf( stdout, "\n" ); 64 | 65 | // create application encoder class 66 | cTAppEncTop.create(); 67 | 68 | // parse configuration 69 | try 70 | { 71 | if(!cTAppEncTop.parseCfg( argc, argv )) 72 | { 73 | cTAppEncTop.destroy(); 74 | return 1; 75 | } 76 | } 77 | catch (po::ParseFailure& e) 78 | { 79 | cerr << "Error parsing option \""<< e.arg <<"\" with argument \""<< e.val <<"\"." << endl; 80 | return 1; 81 | } 82 | 83 | // starting time 84 | double dResult; 85 | long lBefore = clock(); 86 | 87 | // call encoding function 88 | cTAppEncTop.encode(); 89 | 90 | // ending time 91 | dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC; 92 | printf("\n Total Time: %12.3f sec.\n", dResult); 93 | 94 | // destroy application encoder class 95 | cTAppEncTop.destroy(); 96 | 97 | return 0; 98 | } 99 | 100 | //! \} 101 | -------------------------------------------------------------------------------- /hm-14.0/source/App/utils/BitrateTargeting/ExtractBitrates.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef EXTRACT_BITRATES_H 35 | #define EXTRACT_BITRATES_H 36 | 37 | #include "RuntimeError.h" 38 | #include 39 | 40 | /// An error occured while parsing a POC line from within a log file 41 | class POCParseException: public RuntimeError 42 | { 43 | public: 44 | POCParseException( const std::string& pocLine ): m_pocLine( pocLine ) { } 45 | virtual ~POCParseException( ) throw ( ) { } 46 | 47 | protected: 48 | void outputWhat( std::ostream& o ) const { o << "POC parse exception: " << m_pocLine; } 49 | 50 | private: 51 | std::string m_pocLine; 52 | }; 53 | 54 | /// The QP set from the log file was not contiguous. The QP set must be contiguous to be able to convert the results into a vector. 55 | class NonContiguousQPSetException: public RuntimeError 56 | { 57 | public: 58 | virtual ~NonContiguousQPSetException( ) throw( ) { } 59 | 60 | protected: 61 | void outputWhat( std::ostream& o ) const { o << "Non-contiguous QP set exception"; } 62 | }; 63 | 64 | /// Extracts the average bitrates for each of the temporal layers from the given log 65 | /// \param i The input stream that represents the log 66 | /// \return A vector of doubles that contains the average bitrates for each temporal layer 67 | /// \throw POCParseException if an error occured while parsing a POC line 68 | /// \throw NonContiguousQPSetException if the QP set from the log file was not contiguous 69 | std::vector< double > extractBitratesForTemporalLayers( std::istream& i ); 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /hm-14.0/source/App/utils/BitrateTargeting/ExtractBitratesMain.cpp: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #include 35 | #include 36 | #include "ExtractBitrates.h" 37 | 38 | /// In out, finds the first occurence of toFind and replaces it with "e" 39 | /// \pre toFind must have a size of 2 40 | /// \pre The first character in toFind muts be 'e' 41 | /// \pre out must contain toFind 42 | void replaceWithE( std::string &out, const std::string& toFind ) 43 | { 44 | assert( 2 == toFind.size( ) ); 45 | assert( 'e' == toFind[ 0 ] ); 46 | 47 | std::string::size_type pos( out.find( toFind ) ); 48 | assert( pos != std::string::npos ); 49 | out.erase( pos + 1, 1 ); 50 | } 51 | 52 | /// Formatted output for a double with appropriate formatting applied (correct number of digits, etc.) 53 | void outputDouble( std::ostream& left, double right ) 54 | { 55 | std::ostringstream oss; 56 | oss.precision( 6 ); 57 | oss << std::scientific << right; 58 | std::string s( oss.str( ) ); 59 | 60 | replaceWithE( s, "e+" ); 61 | replaceWithE( s, "e0" ); 62 | 63 | left << s; 64 | } 65 | 66 | int main( int, char** ) 67 | { 68 | try 69 | { 70 | std::vector< double > result( extractBitratesForTemporalLayers( std::cin ) ); // Extract the bitrate vector 71 | 72 | // Output the bitrate vector 73 | if( 0 < result.size( ) ) 74 | { 75 | std::vector< double >::const_iterator iter( result.begin( ) ); 76 | outputDouble( std::cout, *iter ); 77 | for( ; ; ) 78 | { 79 | ++iter; 80 | if( result.end( ) == iter ) 81 | { 82 | break; 83 | } 84 | else 85 | { 86 | std::cout << " "; 87 | outputDouble( std::cout, *iter ); 88 | } 89 | } 90 | } 91 | 92 | return 0; 93 | } 94 | catch( std::exception& e ) 95 | { 96 | std::cerr << e.what( ) << std::endl; 97 | return 1; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /hm-14.0/source/App/utils/BitrateTargeting/GuessLambdaModifiersMain.cpp: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | 35 | #include "RuntimeError.h" 36 | #include "GuessLambdaModifiers.h" 37 | #include 38 | 39 | class WrongNumberOfArgumentsException: public RuntimeError 40 | { 41 | public: 42 | virtual ~WrongNumberOfArgumentsException( ) throw( ) { } 43 | protected: 44 | void outputWhat( std::ostream& o ) const { o << "Wrong number of arguments"; } 45 | }; 46 | 47 | int main( int argc, char** ppArgv ) 48 | { 49 | try 50 | { 51 | if( argc != 3 ) throw WrongNumberOfArgumentsException( ); 52 | 53 | std::string initialAdjustmentParameterString( ppArgv[ 1 ] ); 54 | std::istringstream initialAdjustmentParameterIstream( initialAdjustmentParameterString ); 55 | 56 | std::string targetBitratesString( ppArgv[ 2 ] ); 57 | std::istringstream targetBitratesIstream( targetBitratesString ); 58 | 59 | guessLambdaModifiers( std::cout, initialAdjustmentParameterIstream, targetBitratesIstream, std::cin ); 60 | return 0; 61 | 62 | } 63 | catch( std::exception& e ) 64 | { 65 | std::cerr << e.what( ) << std::endl; 66 | } 67 | catch( ... ) 68 | { 69 | std::cerr << "Unknown exception" << std::endl; 70 | } 71 | return 1; 72 | } 73 | -------------------------------------------------------------------------------- /hm-14.0/source/App/utils/BitrateTargeting/QuickStartGuide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hmchen-github/iterative-filtering-intra-prediction/62732d4c32512f6db600b963fde9e1fe5fbe2b99/hm-14.0/source/App/utils/BitrateTargeting/QuickStartGuide.pdf -------------------------------------------------------------------------------- /hm-14.0/source/App/utils/BitrateTargeting/RuntimeError.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef DIRECTORY_LIB_RUNTIME_ERROR_H 35 | #define DIRECTORY_LIB_RUNTIME_ERROR_H 36 | 37 | #include 38 | #include 39 | 40 | /// This class serves the same purpose as std::runtime_error, but it can be more convenient to use 41 | class RuntimeError: public std::runtime_error 42 | { 43 | public: 44 | RuntimeError( ): std::runtime_error( "" ), m_firstWhat( true ) { } 45 | virtual ~RuntimeError( ) throw ( ) { } 46 | 47 | /// Implementation of the std::exception::what method 48 | const char * what( ) const throw( ) 49 | { 50 | if( m_firstWhat ) 51 | { 52 | std::ostringstream o; 53 | outputWhat( o ); 54 | m_what = o.str( ); 55 | m_firstWhat = false; 56 | } 57 | return m_what.c_str( ); 58 | } 59 | 60 | protected: 61 | /// The implementing class implements this method to customize the what output 62 | /// \param o The what stream is outputted to this parameter 63 | virtual void outputWhat( std::ostream & o ) const =0; 64 | 65 | private: 66 | mutable bool m_firstWhat; ///< True i.f.f. the what method has not yet been called 67 | mutable std::string m_what; ///< Contains the what string. Populated by the first call to the what method. 68 | }; 69 | 70 | /// Convenient formatted output operator that just outputs the what string 71 | inline std::ostream& operator<<( std::ostream& left, const RuntimeError& right ) 72 | { 73 | return left << right.what( ); 74 | } 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /hm-14.0/source/App/utils/BitrateTargeting/makefile: -------------------------------------------------------------------------------- 1 | # The copyright in this software is being made available under the BSD 2 | # License, included below. This software may be subject to other third party 3 | # and contributor rights, including patent rights, and no such rights are 4 | # granted under this license. 5 | # 6 | # Copyright (c) 2010-2014, ITU/ISO/IEC 7 | # All rights reserved. 8 | # 9 | # Redistribution and use in source and binary forms, with or without 10 | # modification, are permitted provided that the following conditions are met: 11 | # 12 | # * Redistributions of source code must retain the above copyright notice, 13 | # this list of conditions and the following disclaimer. 14 | # * Redistributions in binary form must reproduce the above copyright notice, 15 | # this list of conditions and the following disclaimer in the documentation 16 | # and/or other materials provided with the distribution. 17 | # * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | # be used to endorse or promote products derived from this software without 19 | # specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | # THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | CPPFLAGS = -D NDEBUG -Wall -Wextra 34 | 35 | extractBitratesObjects = ExtractBitrates.o ExtractBitratesMain.o 36 | extractBitratesExecutable = extractBitrates.exe 37 | 38 | guessLambdaModifiersObjects = GuessLambdaModifiers.o GuessLambdaModifiersMain.o 39 | guessLambdaModifiersExecutable = guessLambdaModifiers.exe 40 | 41 | all: $(extractBitratesExecutable) $(guessLambdaModifiersExecutable) 42 | 43 | $(extractBitratesExecutable): $(extractBitratesObjects) 44 | g++ -o $@ $(extractBitratesObjects) 45 | $(guessLambdaModifiersExecutable): $(guessLambdaModifiersObjects) 46 | g++ -o $@ $(guessLambdaModifiersObjects) 47 | 48 | ExtractBitrates.o: ExtractBitrates.h RuntimeError.h 49 | ExtractBitratesMain.o: ExtractBitrates.h RuntimeError.h 50 | GuessLambdaModifiers.o: GuessLambdaModifiers.h RuntimeError.h 51 | GuessLambdaModifiersMain.o: GuessLambdaModifiers.h RuntimeError.h 52 | 53 | clean: 54 | rm $(extractBitratesExecutable) $(extractBitratesObjects) $(guessLambdaModifiersExecutable) $(guessLambdaModifiersObjects) 55 | -------------------------------------------------------------------------------- /hm-14.0/source/App/utils/convert_NtoMbit_YCbCr.cpp: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #include 35 | 36 | #include "TLibCommon/TComPicYuv.h" 37 | #include "TLibVideoIO/TVideoIOYuv.h" 38 | #include "TAppCommon/program_options_lite.h" 39 | 40 | using namespace std; 41 | namespace po = df::program_options_lite; 42 | 43 | int main(int argc, const char** argv) 44 | { 45 | bool do_help; 46 | string filename_in, filename_out; 47 | unsigned int width, height; 48 | unsigned int bitdepth_in, bitdepth_out; 49 | unsigned int num_frames; 50 | unsigned int num_frames_skip; 51 | 52 | po::Options opts; 53 | opts.addOptions() 54 | ("help", do_help, false, "this help text") 55 | ("InputFile,i", filename_in, string(""), "input file to convert") 56 | ("OutputFile,o", filename_out, string(""), "output file") 57 | ("SourceWidth", width, 0u, "source picture width") 58 | ("SourceHeight", height, 0u, "source picture height") 59 | ("InputBitDepth", bitdepth_in, 8u, "bit-depth of input file") 60 | ("OutputBitDepth", bitdepth_out, 8u, "bit-depth of output file") 61 | ("NumFrames", num_frames, 0xffffffffu, "number of frames to process") 62 | ("FrameSkip,-fs", num_frames_skip, 0u, "Number of frames to skip at start of input YUV") 63 | ; 64 | 65 | po::setDefaults(opts); 66 | po::scanArgv(opts, argc, argv); 67 | 68 | if (argc == 1 || do_help) 69 | { 70 | /* argc == 1: no options have been specified */ 71 | po::doHelp(cout, opts); 72 | return EXIT_FAILURE; 73 | } 74 | 75 | TVideoIOYuv input; 76 | TVideoIOYuv output; 77 | 78 | input.open((char*)filename_in.c_str(), false, bitdepth_in, bitdepth_in, bitdepth_out, bitdepth_out); 79 | output.open((char*)filename_out.c_str(), true, bitdepth_out, bitdepth_out, bitdepth_out, bitdepth_out); 80 | 81 | input.skipFrames(num_frames_skip, width, height); 82 | 83 | TComPicYuv frame; 84 | frame.create( width, height, 1, 1, 0 ); 85 | 86 | int pad[2] = {0, 0}; 87 | 88 | unsigned int num_frames_processed = 0; 89 | while (!input.isEof()) 90 | { 91 | if (! input.read(&frame, pad)) 92 | { 93 | break; 94 | } 95 | #if 0 96 | Pel* img = frame.getLumaAddr(); 97 | for (int y = 0; y < height; y++) 98 | { 99 | for (int x = 0; x < height; x++) 100 | img[x] = 0; 101 | img += frame.getStride(); 102 | } 103 | img = frame.getLumaAddr(); 104 | img[0] = 1; 105 | #endif 106 | 107 | output.write(&frame); 108 | num_frames_processed++; 109 | if (num_frames_processed == num_frames) 110 | break; 111 | } 112 | 113 | input.close(); 114 | output.close(); 115 | 116 | return EXIT_SUCCESS; 117 | } 118 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibCommon/AccessUnit.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | \file AccessUnit.h 36 | \brief Access Unit class (header) 37 | */ 38 | 39 | #pragma once 40 | 41 | #include 42 | #include "NAL.h" 43 | 44 | //! \ingroup TLibCommon 45 | //! \{ 46 | 47 | /** 48 | * An AccessUnit is a list of one or more NAL units, according to the 49 | * working draft. All NAL units within the object belong to the same 50 | * access unit. 51 | * 52 | * NALUnits held in the AccessUnit list are in EBSP format. Attempting 53 | * to insert an OutputNALUnit into the access unit will automatically cause 54 | * the nalunit to have its headers written and anti-emulation performed. 55 | * 56 | * The AccessUnit owns all pointers stored within. Destroying the 57 | * AccessUnit will delete all contained objects. 58 | */ 59 | class AccessUnit : public std::list 60 | { 61 | public: 62 | ~AccessUnit() 63 | { 64 | for (AccessUnit::iterator it = this->begin(); it != this->end(); it++) 65 | { 66 | delete *it; 67 | } 68 | } 69 | }; 70 | 71 | //! \} 72 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibCommon/ContextModel.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | 35 | /** \file ContextModel.h 36 | \brief context model class (header) 37 | */ 38 | 39 | #ifndef __CONTEXT_MODEL__ 40 | #define __CONTEXT_MODEL__ 41 | 42 | #if _MSC_VER > 1000 43 | #pragma once 44 | #endif // _MSC_VER > 1000 45 | 46 | #include "CommonDef.h" 47 | 48 | //! \ingroup TLibCommon 49 | //! \{ 50 | 51 | // ==================================================================================================================== 52 | // Class definition 53 | // ==================================================================================================================== 54 | 55 | /// context model class 56 | class ContextModel 57 | { 58 | public: 59 | ContextModel () { m_ucState = 0; m_binsCoded = 0; } 60 | ~ContextModel () {} 61 | 62 | UChar getState () { return ( m_ucState >> 1 ); } ///< get current state 63 | UChar getMps () { return ( m_ucState & 1 ); } ///< get curret MPS 64 | Void setStateAndMps( UChar ucState, UChar ucMPS) { m_ucState = (ucState << 1) + ucMPS; } ///< set state and MPS 65 | 66 | Void init ( Int qp, Int initValue ); ///< initialize state with initial probability 67 | 68 | Void updateLPS () 69 | { 70 | m_ucState = m_aucNextStateLPS[ m_ucState ]; 71 | } 72 | 73 | Void updateMPS () 74 | { 75 | m_ucState = m_aucNextStateMPS[ m_ucState ]; 76 | } 77 | 78 | Int getEntropyBits(Short val) { return m_entropyBits[m_ucState ^ val]; } 79 | 80 | #if FAST_BIT_EST 81 | Void update( Int binVal ) 82 | { 83 | m_ucState = m_nextState[m_ucState][binVal]; 84 | } 85 | static Void buildNextStateTable(); 86 | static Int getEntropyBitsTrm( Int val ) { return m_entropyBits[126 ^ val]; } 87 | #endif 88 | Void setBinsCoded(UInt val) { m_binsCoded = val; } 89 | UInt getBinsCoded() { return m_binsCoded; } 90 | 91 | private: 92 | UChar m_ucState; ///< internal state variable 93 | static const UChar m_aucNextStateMPS[ 128 ]; 94 | static const UChar m_aucNextStateLPS[ 128 ]; 95 | static const Int m_entropyBits[ 128 ]; 96 | #if FAST_BIT_EST 97 | static UChar m_nextState[128][2]; 98 | #endif 99 | UInt m_binsCoded; 100 | }; 101 | 102 | //! \} 103 | 104 | #endif 105 | 106 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibCommon/ContextModel3DBuffer.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file ContextModel3DBuffer.h 35 | \brief context model 3D buffer class (header) 36 | */ 37 | 38 | #ifndef _HM_CONTEXT_MODEL_3DBUFFER_H_ 39 | #define _HM_CONTEXT_MODEL_3DBUFFER_H_ 40 | 41 | #include 42 | #include 43 | #include 44 | 45 | #include "CommonDef.h" 46 | #include "ContextModel.h" 47 | 48 | //! \ingroup TLibCommon 49 | //! \{ 50 | 51 | // ==================================================================================================================== 52 | // Class definition 53 | // ==================================================================================================================== 54 | 55 | /// context model 3D buffer class 56 | class ContextModel3DBuffer 57 | { 58 | protected: 59 | ContextModel* m_contextModel; ///< array of context models 60 | const UInt m_sizeX; ///< X size of 3D buffer 61 | const UInt m_sizeXY; ///< X times Y size of 3D buffer 62 | const UInt m_sizeXYZ; ///< total size of 3D buffer 63 | 64 | public: 65 | ContextModel3DBuffer ( UInt uiSizeZ, UInt uiSizeY, UInt uiSizeX, ContextModel *basePtr, Int &count ); 66 | ~ContextModel3DBuffer () {} 67 | 68 | // access functions 69 | ContextModel& get( UInt uiZ, UInt uiY, UInt uiX ) 70 | { 71 | return m_contextModel[ uiZ * m_sizeXY + uiY * m_sizeX + uiX ]; 72 | } 73 | ContextModel* get( UInt uiZ, UInt uiY ) 74 | { 75 | return &m_contextModel[ uiZ * m_sizeXY + uiY * m_sizeX ]; 76 | } 77 | ContextModel* get( UInt uiZ ) 78 | { 79 | return &m_contextModel[ uiZ * m_sizeXY ]; 80 | } 81 | 82 | // initialization & copy functions 83 | Void initBuffer( SliceType eSliceType, Int iQp, UChar* ctxModel ); ///< initialize 3D buffer by slice type & QP 84 | 85 | UInt calcCost( SliceType sliceType, Int qp, UChar* ctxModel ); ///< determine cost of choosing a probability table based on current probabilities 86 | /** copy from another buffer 87 | * \param src buffer to copy from 88 | */ 89 | Void copyFrom( ContextModel3DBuffer* src ) 90 | { 91 | assert( m_sizeXYZ == src->m_sizeXYZ ); 92 | ::memcpy( m_contextModel, src->m_contextModel, sizeof(ContextModel) * m_sizeXYZ ); 93 | } 94 | }; 95 | 96 | //! \} 97 | 98 | #endif // _HM_CONTEXT_MODEL_3DBUFFER_H_ 99 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibCommon/SEI.cpp: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file SEI.cpp 35 | \brief helper functions for SEI handling 36 | */ 37 | 38 | #include "CommonDef.h" 39 | #include "SEI.h" 40 | 41 | //Table D-7 Meaning of camera iso sensitivity indicator and exposure index rating indicator 42 | Int Table_exp_indicator[32] = {0, 10, 12, 16, 20, 25, 32, 40, 50, 64, 80, 100, 125, 160, 200, 250, 320, 400, 500, 640, 800, 1000, 1250, 1600, 2000, 2500, 3200, 4000, 5000, 6400, 8000, -1}; 43 | 44 | SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType) 45 | { 46 | SEIMessages result; 47 | 48 | for (SEIMessages::iterator it=seiList.begin(); it!=seiList.end(); it++) 49 | { 50 | if ((*it)->payloadType() == seiType) 51 | { 52 | result.push_back(*it); 53 | } 54 | } 55 | return result; 56 | } 57 | 58 | SEIMessages extractSeisByType(SEIMessages &seiList, SEI::PayloadType seiType) 59 | { 60 | SEIMessages result; 61 | 62 | SEIMessages::iterator it=seiList.begin(); 63 | while ( it!=seiList.end() ) 64 | { 65 | if ((*it)->payloadType() == seiType) 66 | { 67 | result.push_back(*it); 68 | it = seiList.erase(it); 69 | } 70 | else 71 | { 72 | it++; 73 | } 74 | } 75 | return result; 76 | } 77 | 78 | 79 | Void deleteSEIs (SEIMessages &seiList) 80 | { 81 | for (SEIMessages::iterator it=seiList.begin(); it!=seiList.end(); it++) 82 | { 83 | delete (*it); 84 | } 85 | seiList.clear(); 86 | } 87 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibCommon/TComBitCounter.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TComBitCounter.h 35 | \brief Class for counting bits (header) 36 | */ 37 | 38 | #ifndef __COMBITCOUNTER__ 39 | #define __COMBITCOUNTER__ 40 | 41 | #if _MSC_VER > 1000 42 | #pragma once 43 | #endif // _MSC_VER > 1000 44 | 45 | #include "TComBitStream.h" 46 | 47 | //! \ingroup TLibCommon 48 | //! \{ 49 | 50 | // ==================================================================================================================== 51 | // Class definition 52 | // ==================================================================================================================== 53 | 54 | /// class for counting bits 55 | class TComBitCounter : public TComBitIf 56 | { 57 | protected: 58 | UInt m_uiBitCounter; 59 | 60 | public: 61 | TComBitCounter() {} 62 | virtual ~TComBitCounter() {} 63 | 64 | Void write ( UInt /*uiBits*/, UInt uiNumberOfBits ) { m_uiBitCounter += uiNumberOfBits; } 65 | Void resetBits () { m_uiBitCounter = 0; } 66 | UInt getNumberOfWrittenBits() const { return m_uiBitCounter; } 67 | }; 68 | 69 | //! \} 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibCommon/TComCABACTables.cpp: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TComCABACTables.cpp 35 | * \brief static class for CABAC tables 36 | */ 37 | 38 | #include "TComCABACTables.h" 39 | 40 | //! \ingroup TLibCommon 41 | //! \{ 42 | 43 | const UChar TComCABACTables::sm_aucLPSTable[64][4] = 44 | { 45 | { 128, 176, 208, 240}, 46 | { 128, 167, 197, 227}, 47 | { 128, 158, 187, 216}, 48 | { 123, 150, 178, 205}, 49 | { 116, 142, 169, 195}, 50 | { 111, 135, 160, 185}, 51 | { 105, 128, 152, 175}, 52 | { 100, 122, 144, 166}, 53 | { 95, 116, 137, 158}, 54 | { 90, 110, 130, 150}, 55 | { 85, 104, 123, 142}, 56 | { 81, 99, 117, 135}, 57 | { 77, 94, 111, 128}, 58 | { 73, 89, 105, 122}, 59 | { 69, 85, 100, 116}, 60 | { 66, 80, 95, 110}, 61 | { 62, 76, 90, 104}, 62 | { 59, 72, 86, 99}, 63 | { 56, 69, 81, 94}, 64 | { 53, 65, 77, 89}, 65 | { 51, 62, 73, 85}, 66 | { 48, 59, 69, 80}, 67 | { 46, 56, 66, 76}, 68 | { 43, 53, 63, 72}, 69 | { 41, 50, 59, 69}, 70 | { 39, 48, 56, 65}, 71 | { 37, 45, 54, 62}, 72 | { 35, 43, 51, 59}, 73 | { 33, 41, 48, 56}, 74 | { 32, 39, 46, 53}, 75 | { 30, 37, 43, 50}, 76 | { 29, 35, 41, 48}, 77 | { 27, 33, 39, 45}, 78 | { 26, 31, 37, 43}, 79 | { 24, 30, 35, 41}, 80 | { 23, 28, 33, 39}, 81 | { 22, 27, 32, 37}, 82 | { 21, 26, 30, 35}, 83 | { 20, 24, 29, 33}, 84 | { 19, 23, 27, 31}, 85 | { 18, 22, 26, 30}, 86 | { 17, 21, 25, 28}, 87 | { 16, 20, 23, 27}, 88 | { 15, 19, 22, 25}, 89 | { 14, 18, 21, 24}, 90 | { 14, 17, 20, 23}, 91 | { 13, 16, 19, 22}, 92 | { 12, 15, 18, 21}, 93 | { 12, 14, 17, 20}, 94 | { 11, 14, 16, 19}, 95 | { 11, 13, 15, 18}, 96 | { 10, 12, 15, 17}, 97 | { 10, 12, 14, 16}, 98 | { 9, 11, 13, 15}, 99 | { 9, 11, 12, 14}, 100 | { 8, 10, 12, 14}, 101 | { 8, 9, 11, 13}, 102 | { 7, 9, 11, 12}, 103 | { 7, 9, 10, 12}, 104 | { 7, 8, 10, 11}, 105 | { 6, 8, 9, 11}, 106 | { 6, 7, 9, 10}, 107 | { 6, 7, 8, 9}, 108 | { 2, 2, 2, 2} 109 | }; 110 | 111 | const UChar TComCABACTables::sm_aucRenormTable[32] = 112 | { 113 | 6, 5, 4, 4, 114 | 3, 3, 3, 3, 115 | 2, 2, 2, 2, 116 | 2, 2, 2, 2, 117 | 1, 1, 1, 1, 118 | 1, 1, 1, 1, 119 | 1, 1, 1, 1, 120 | 1, 1, 1, 1 121 | }; 122 | 123 | //! \} 124 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibCommon/TComCABACTables.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TComCABACTables.h 35 | \brief static class for CABAC tables 36 | */ 37 | 38 | #ifndef __TCOM_CABAC_TABLES__ 39 | #define __TCOM_CABAC_TABLES__ 40 | 41 | #include "TLibCommon/CommonDef.h" 42 | 43 | //! \ingroup TLibCommon 44 | //! \{ 45 | 46 | /** 47 | * \brief static class for CABAC tables 48 | */ 49 | 50 | class TComCABACTables 51 | { 52 | public: 53 | const static UChar sm_aucLPSTable[64][4]; 54 | const static UChar sm_aucRenormTable[32]; 55 | }; 56 | 57 | 58 | //! \} 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibCommon/TComInterpolationFilter.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | * \file 36 | * \brief Declaration of TComInterpolationFilter class 37 | */ 38 | 39 | #ifndef __HM_TCOMINTERPOLATIONFILTER_H__ 40 | #define __HM_TCOMINTERPOLATIONFILTER_H__ 41 | 42 | #include "TypeDef.h" 43 | 44 | //! \ingroup TLibCommon 45 | //! \{ 46 | 47 | #define NTAPS_LUMA 8 ///< Number of taps for luma 48 | #define NTAPS_CHROMA 4 ///< Number of taps for chroma 49 | #define IF_INTERNAL_PREC 14 ///< Number of bits for internal precision 50 | #define IF_FILTER_PREC 6 ///< Log2 of sum of filter taps 51 | #define IF_INTERNAL_OFFS (1<<(IF_INTERNAL_PREC-1)) ///< Offset used internally 52 | 53 | /** 54 | * \brief Interpolation filter class 55 | */ 56 | class TComInterpolationFilter 57 | { 58 | static const Short m_lumaFilter[4][NTAPS_LUMA]; ///< Luma filter taps 59 | static const Short m_chromaFilter[8][NTAPS_CHROMA]; ///< Chroma filter taps 60 | 61 | static Void filterCopy(Int bitDepth, const Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast); 62 | 63 | template 64 | static Void filter(Int bitDepth, Pel const *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Short const *coeff); 65 | 66 | template 67 | static Void filterHor(Int bitDepth, Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isLast, Short const *coeff); 68 | template 69 | static Void filterVer(Int bitDepth, Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast, Short const *coeff); 70 | 71 | public: 72 | TComInterpolationFilter() {} 73 | ~TComInterpolationFilter() {} 74 | 75 | Void filterHorLuma (Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast ); 76 | Void filterVerLuma (Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast ); 77 | Void filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast ); 78 | Void filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast ); 79 | }; 80 | 81 | //! \} 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibCommon/TComList.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TComList.h 35 | \brief general list class (header) 36 | */ 37 | 38 | #ifndef _TCOMLIST_ 39 | #define _TCOMLIST_ 40 | 41 | #if _MSC_VER > 1000 42 | #pragma once 43 | #endif // _MSC_VER > 1000 44 | 45 | #include 46 | #include 47 | #include "CommonDef.h" 48 | 49 | #include 50 | using namespace std; 51 | 52 | //! \ingroup TLibCommon 53 | //! \{ 54 | 55 | // ==================================================================================================================== 56 | // Class definition 57 | // ==================================================================================================================== 58 | 59 | /// list template 60 | template< class C > 61 | class TComList : public std::list< C > 62 | { 63 | public: 64 | typedef typename std::list::iterator TComIterator; 65 | 66 | TComList& operator += ( const TComList& rcTComList) 67 | { 68 | if( ! rcTComList.empty() ) 69 | { 70 | insert( this->end(), rcTComList.begin(), rcTComList.end()); 71 | } 72 | return *this; 73 | } // leszek 74 | 75 | C popBack() 76 | { 77 | C cT = this->back(); 78 | this->pop_back(); 79 | return cT; 80 | } 81 | 82 | C popFront() 83 | { 84 | C cT = this->front(); 85 | this->pop_front(); 86 | return cT; 87 | } 88 | 89 | Void pushBack( const C& rcT ) 90 | { 91 | /*assert( sizeof(C) == 4);*/ 92 | if( rcT != NULL ) 93 | { 94 | this->push_back( rcT); 95 | } 96 | } 97 | 98 | Void pushFront( const C& rcT ) 99 | { 100 | /*assert( sizeof(C) == 4);*/ 101 | if( rcT != NULL ) 102 | { 103 | this->push_front( rcT); 104 | } 105 | } 106 | 107 | TComIterator find( const C& rcT ) // leszek 108 | { 109 | return find( this->begin(), this->end(), rcT ); 110 | } 111 | }; 112 | 113 | //! \} 114 | 115 | #endif 116 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibCommon/TComRdCostWeightPrediction.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TComRdCostWeightPrediction.h 35 | \brief RD cost computation classes (header) 36 | */ 37 | 38 | #ifndef __TCOMRDCOSTWEIGHTPREDICTION__ 39 | #define __TCOMRDCOSTWEIGHTPREDICTION__ 40 | 41 | 42 | #include "CommonDef.h" 43 | #include "TComPattern.h" 44 | #include "TComMv.h" 45 | #include "TComRdCost.h" 46 | #include "TComSlice.h" 47 | 48 | class DistParam; 49 | class TComPattern; 50 | 51 | // ==================================================================================================================== 52 | // Class definition 53 | // ==================================================================================================================== 54 | 55 | /// RD cost computation class, with Weighted Prediction 56 | class TComRdCostWeightPrediction 57 | { 58 | private: 59 | static Int m_w0, m_w1; // current wp scaling values 60 | static Int m_shift; 61 | static Int m_offset; 62 | static Int m_round; 63 | static Bool m_xSetDone; 64 | 65 | public: 66 | TComRdCostWeightPrediction(); 67 | virtual ~TComRdCostWeightPrediction(); 68 | 69 | protected: 70 | 71 | static inline Void xSetWPscale(Int w0, Int w1, Int shift, Int offset, Int round); 72 | 73 | static UInt xGetSSEw ( DistParam* pcDtParam ); 74 | static UInt xGetSADw ( DistParam* pcDtParam ); 75 | static UInt xGetHADs4w ( DistParam* pcDtParam ); 76 | static UInt xGetHADs8w ( DistParam* pcDtParam ); 77 | static UInt xGetHADsw ( DistParam* pcDtParam ); 78 | static UInt xCalcHADs2x2w ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); 79 | static UInt xCalcHADs4x4w ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); 80 | static UInt xCalcHADs8x8w ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); 81 | 82 | };// END CLASS DEFINITION TComRdCostWeightPrediction 83 | 84 | inline Void TComRdCostWeightPrediction::xSetWPscale(Int w0, Int w1, Int shift, Int offset, Int round) 85 | { 86 | m_w0 = w0; 87 | m_w1 = w1; 88 | m_shift = shift; 89 | m_offset = offset; 90 | m_round = round; 91 | 92 | m_xSetDone = true; 93 | } 94 | 95 | #endif // __TCOMRDCOSTWEIGHTPREDICTION__ 96 | 97 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibCommon/TComWeightPrediction.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TComWeightPrediction.h 35 | \brief weighting prediction class (header) 36 | */ 37 | 38 | #ifndef __TCOMWEIGHTPREDICTION__ 39 | #define __TCOMWEIGHTPREDICTION__ 40 | 41 | 42 | // Include files 43 | #include "TComPic.h" 44 | #include "TComMotionInfo.h" 45 | #include "TComPattern.h" 46 | #include "TComTrQuant.h" 47 | #include "TComInterpolationFilter.h" 48 | 49 | // ==================================================================================================================== 50 | // Class definition 51 | // ==================================================================================================================== 52 | /// weighting prediction class 53 | class TComWeightPrediction 54 | { 55 | public: 56 | TComWeightPrediction(); 57 | 58 | Void getWpScaling( TComDataCU* pcCU, Int iRefIdx0, Int iRefIdx1, wpScalingParam *&wp0 , wpScalingParam *&wp1); 59 | 60 | Void addWeightBi( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iWidth, UInt iHeight, wpScalingParam *wp0, wpScalingParam *wp1, TComYuv* rpcYuvDst, Bool bRound=true ); 61 | Void addWeightUni( TComYuv* pcYuvSrc0, UInt iPartUnitIdx, UInt iWidth, UInt iHeight, wpScalingParam *wp0, TComYuv* rpcYuvDst ); 62 | 63 | Void xWeightedPredictionUni( TComDataCU* pcCU, TComYuv* pcYuvSrc, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iRefIdx=-1 ); 64 | Void xWeightedPredictionBi( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv* rpcYuvDst ); 65 | }; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibDecoder/NALread.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | \file NALread.h 36 | \brief reading funtionality for NAL units 37 | */ 38 | 39 | #pragma once 40 | 41 | #include "TLibCommon/TypeDef.h" 42 | #include "TLibCommon/TComBitStream.h" 43 | #include "TLibCommon/NAL.h" 44 | 45 | //! \ingroup TLibDecoder 46 | //! \{ 47 | 48 | /** 49 | * A convenience wrapper to NALUnit that also provides a 50 | * bitstream object. 51 | */ 52 | struct InputNALUnit : public NALUnit 53 | { 54 | InputNALUnit() : m_Bitstream(0) {}; 55 | ~InputNALUnit() { delete m_Bitstream; } 56 | 57 | TComInputBitstream* m_Bitstream; 58 | }; 59 | 60 | void read(InputNALUnit& nalu, std::vector& nalUnitBuf); 61 | 62 | //! \} 63 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibDecoder/SEIread.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | \file SEIread.h 36 | \brief reading funtionality for SEI messages 37 | */ 38 | 39 | #ifndef __SEIREAD__ 40 | #define __SEIREAD__ 41 | 42 | #if _MSC_VER > 1000 43 | #pragma once 44 | #endif // _MSC_VER > 1000 45 | 46 | //! \ingroup TLibDecoder 47 | //! \{ 48 | 49 | #include "TLibCommon/SEI.h" 50 | class TComInputBitstream; 51 | 52 | 53 | class SEIReader: public SyntaxElementParser 54 | { 55 | public: 56 | SEIReader() {}; 57 | virtual ~SEIReader() {}; 58 | Void parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps); 59 | protected: 60 | Void xReadSEImessage (SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps); 61 | Void xParseSEIuserDataUnregistered (SEIuserDataUnregistered &sei, UInt payloadSize); 62 | Void xParseSEIActiveParameterSets (SEIActiveParameterSets &sei, UInt payloadSize); 63 | Void xParseSEIDecodingUnitInfo (SEIDecodingUnitInfo& sei, UInt payloadSize, TComSPS *sps); 64 | Void xParseSEIDecodedPictureHash (SEIDecodedPictureHash& sei, UInt payloadSize); 65 | Void xParseSEIBufferingPeriod (SEIBufferingPeriod& sei, UInt payloadSize, TComSPS *sps); 66 | Void xParseSEIPictureTiming (SEIPictureTiming& sei, UInt payloadSize, TComSPS *sps); 67 | Void xParseSEIRecoveryPoint (SEIRecoveryPoint& sei, UInt payloadSize); 68 | Void xParseSEIFramePacking (SEIFramePacking& sei, UInt payloadSize); 69 | Void xParseSEIDisplayOrientation (SEIDisplayOrientation &sei, UInt payloadSize); 70 | Void xParseSEITemporalLevel0Index (SEITemporalLevel0Index &sei, UInt payloadSize); 71 | Void xParseSEIGradualDecodingRefreshInfo (SEIGradualDecodingRefreshInfo &sei, UInt payloadSize); 72 | Void xParseSEIToneMappingInfo (SEIToneMappingInfo& sei, UInt payloadSize); 73 | Void xParseSEISOPDescription (SEISOPDescription &sei, UInt payloadSize); 74 | Void xParseSEIScalableNesting (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps); 75 | Void xParseByteAlign(); 76 | }; 77 | 78 | 79 | //! \} 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibDecoder/SyntaxElementParser.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file SyntaxElementParser.h 35 | \brief Parsing functionality high level syntax 36 | */ 37 | 38 | #ifndef __SYNTAXELEMENTPARSER__ 39 | #define __SYNTAXELEMENTPARSER__ 40 | 41 | #if _MSC_VER > 1000 42 | #pragma once 43 | #endif // _MSC_VER > 1000 44 | 45 | #include "TLibCommon/TComRom.h" 46 | 47 | #if ENC_DEC_TRACE 48 | 49 | #define READ_CODE(length, code, name) xReadCodeTr ( length, code, name ) 50 | #define READ_UVLC( code, name) xReadUvlcTr ( code, name ) 51 | #define READ_SVLC( code, name) xReadSvlcTr ( code, name ) 52 | #define READ_FLAG( code, name) xReadFlagTr ( code, name ) 53 | 54 | #else 55 | 56 | #define READ_CODE(length, code, name) xReadCode ( length, code ) 57 | #define READ_UVLC( code, name) xReadUvlc ( code ) 58 | #define READ_SVLC( code, name) xReadSvlc ( code ) 59 | #define READ_FLAG( code, name) xReadFlag ( code ) 60 | 61 | #endif 62 | 63 | //! \ingroup TLibDecoder 64 | //! \{ 65 | 66 | // ==================================================================================================================== 67 | // Class definition 68 | // ==================================================================================================================== 69 | 70 | class SyntaxElementParser 71 | { 72 | protected: 73 | TComInputBitstream* m_pcBitstream; 74 | 75 | SyntaxElementParser() 76 | : m_pcBitstream (NULL) 77 | {}; 78 | virtual ~SyntaxElementParser() {}; 79 | 80 | Void xReadCode ( UInt length, UInt& val ); 81 | Void xReadUvlc ( UInt& val ); 82 | Void xReadSvlc ( Int& val ); 83 | Void xReadFlag ( UInt& val ); 84 | #if ENC_DEC_TRACE 85 | Void xReadCodeTr (UInt length, UInt& rValue, const Char *pSymbolName); 86 | Void xReadUvlcTr ( UInt& rValue, const Char *pSymbolName); 87 | Void xReadSvlcTr ( Int& rValue, const Char *pSymbolName); 88 | Void xReadFlagTr ( UInt& rValue, const Char *pSymbolName); 89 | #endif 90 | public: 91 | Void setBitstream ( TComInputBitstream* p ) { m_pcBitstream = p; } 92 | TComInputBitstream* getBitstream() { return m_pcBitstream; } 93 | }; 94 | 95 | //! \} 96 | 97 | #endif // !defined(__SYNTAXELEMENTPARSER__) 98 | 99 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibDecoder/TDecBinCoder.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TDecBinCoder.h 35 | \brief binary entropy decoder interface 36 | */ 37 | 38 | #ifndef __TDEC_BIN_CODER__ 39 | #define __TDEC_BIN_CODER__ 40 | 41 | #include "TLibCommon/ContextModel.h" 42 | #include "TLibCommon/TComBitStream.h" 43 | 44 | //! \ingroup TLibDecoder 45 | //! \{ 46 | class TDecBinCABAC; 47 | 48 | class TDecBinIf 49 | { 50 | public: 51 | virtual Void init ( TComInputBitstream* pcTComBitstream ) = 0; 52 | virtual Void uninit () = 0; 53 | 54 | virtual Void start () = 0; 55 | virtual Void finish () = 0; 56 | 57 | virtual Void decodeBin ( UInt& ruiBin, ContextModel& rcCtxModel ) = 0; 58 | virtual Void decodeBinEP ( UInt& ruiBin ) = 0; 59 | virtual Void decodeBinsEP ( UInt& ruiBins, Int numBins ) = 0; 60 | virtual Void decodeBinTrm ( UInt& ruiBin ) = 0; 61 | 62 | virtual Void xReadPCMCode ( UInt uiLength, UInt& ruiCode) = 0; 63 | 64 | virtual ~TDecBinIf() {} 65 | 66 | virtual Void copyState ( TDecBinIf* pcTDecBinIf ) = 0; 67 | virtual TDecBinCABAC* getTDecBinCABAC () { return 0; } 68 | }; 69 | 70 | //! \} 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibDecoder/TDecBinCoderCABAC.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TDecBinCoderCABAC.h 35 | \brief binary entropy decoder of CABAC 36 | */ 37 | 38 | #ifndef __TDEC_BIN_CODER_CABAC__ 39 | #define __TDEC_BIN_CODER_CABAC__ 40 | 41 | #include "TLibCommon/TComCABACTables.h" 42 | #include "TDecBinCoder.h" 43 | 44 | //! \ingroup TLibDecoder 45 | //! \{ 46 | 47 | class TDecBinCABAC : public TDecBinIf 48 | { 49 | public: 50 | TDecBinCABAC (); 51 | virtual ~TDecBinCABAC(); 52 | 53 | Void init ( TComInputBitstream* pcTComBitstream ); 54 | Void uninit (); 55 | 56 | Void start (); 57 | Void finish (); 58 | 59 | Void decodeBin ( UInt& ruiBin, ContextModel& rcCtxModel ); 60 | Void decodeBinEP ( UInt& ruiBin ); 61 | Void decodeBinsEP ( UInt& ruiBin, Int numBins ); 62 | Void decodeBinTrm ( UInt& ruiBin ); 63 | 64 | Void xReadPCMCode ( UInt uiLength, UInt& ruiCode ); 65 | 66 | Void copyState ( TDecBinIf* pcTDecBinIf ); 67 | TDecBinCABAC* getTDecBinCABAC() { return this; } 68 | 69 | private: 70 | TComInputBitstream* m_pcTComBitstream; 71 | UInt m_uiRange; 72 | UInt m_uiValue; 73 | Int m_bitsNeeded; 74 | }; 75 | 76 | //! \} 77 | 78 | #endif 79 | 80 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibEncoder/AnnexBwrite.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #pragma once 35 | 36 | #include 37 | #include "TLibCommon/AccessUnit.h" 38 | #include "NALwrite.h" 39 | 40 | //! \ingroup TLibEncoder 41 | //! \{ 42 | 43 | /** 44 | * write all NALunits in au to bytestream out in a manner satisfying 45 | * AnnexB of AVC. NALunits are written in the order they are found in au. 46 | * the zero_byte word is appended to: 47 | * - the initial startcode in the access unit, 48 | * - any SPS/PPS nal units 49 | */ 50 | static std::vector writeAnnexB(std::ostream& out, const AccessUnit& au) 51 | { 52 | std::vector annexBsizes; 53 | 54 | for (AccessUnit::const_iterator it = au.begin(); it != au.end(); it++) 55 | { 56 | const NALUnitEBSP& nalu = **it; 57 | UInt size = 0; /* size of annexB unit in bytes */ 58 | 59 | static const Char start_code_prefix[] = {0,0,0,1}; 60 | if (it == au.begin() || nalu.m_nalUnitType == NAL_UNIT_VPS || nalu.m_nalUnitType == NAL_UNIT_SPS || nalu.m_nalUnitType == NAL_UNIT_PPS) 61 | { 62 | /* From AVC, When any of the following conditions are fulfilled, the 63 | * zero_byte syntax element shall be present: 64 | * - the nal_unit_type within the nal_unit() is equal to 7 (sequence 65 | * parameter set) or 8 (picture parameter set), 66 | * - the byte stream NAL unit syntax structure contains the first NAL 67 | * unit of an access unit in decoding order, as specified by subclause 68 | * 7.4.1.2.3. 69 | */ 70 | out.write(start_code_prefix, 4); 71 | size += 4; 72 | } 73 | else 74 | { 75 | out.write(start_code_prefix+1, 3); 76 | size += 3; 77 | } 78 | out << nalu.m_nalUnitData.str(); 79 | size += UInt(nalu.m_nalUnitData.str().size()); 80 | 81 | annexBsizes.push_back(size); 82 | } 83 | 84 | return annexBsizes; 85 | } 86 | //! \} 87 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibEncoder/NALwrite.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #pragma once 35 | 36 | #include 37 | 38 | #include "TLibCommon/TypeDef.h" 39 | #include "TLibCommon/TComBitStream.h" 40 | #include "TLibCommon/NAL.h" 41 | 42 | //! \ingroup TLibEncoder 43 | //! \{ 44 | 45 | /** 46 | * A convenience wrapper to NALUnit that also provides a 47 | * bitstream object. 48 | */ 49 | struct OutputNALUnit : public NALUnit 50 | { 51 | /** 52 | * construct an OutputNALunit structure with given header values and 53 | * storage for a bitstream. Upon construction the NALunit header is 54 | * written to the bitstream. 55 | */ 56 | OutputNALUnit( 57 | NalUnitType nalUnitType, 58 | UInt temporalID = 0, 59 | UInt reserved_zero_6bits = 0) 60 | : NALUnit(nalUnitType, temporalID, reserved_zero_6bits) 61 | , m_Bitstream() 62 | {} 63 | 64 | OutputNALUnit& operator=(const NALUnit& src) 65 | { 66 | m_Bitstream.clear(); 67 | static_cast(this)->operator=(src); 68 | return *this; 69 | } 70 | 71 | TComOutputBitstream m_Bitstream; 72 | }; 73 | 74 | void write(std::ostream& out, OutputNALUnit& nalu); 75 | void writeRBSPTrailingBits(TComOutputBitstream& bs); 76 | 77 | inline NALUnitEBSP::NALUnitEBSP(OutputNALUnit& nalu) 78 | : NALUnit(nalu) 79 | { 80 | write(m_nalUnitData, nalu); 81 | } 82 | 83 | void copyNaluData(OutputNALUnit& naluDest, const OutputNALUnit& naluSrc); 84 | 85 | //! \} 86 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibEncoder/SEIwrite.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #pragma once 35 | 36 | #include "SyntaxElementWriter.h" 37 | #include "TLibCommon/SEI.h" 38 | 39 | class TComBitIf; 40 | 41 | //! \ingroup TLibEncoder 42 | //! \{ 43 | class SEIWriter:public SyntaxElementWriter 44 | { 45 | public: 46 | SEIWriter() {}; 47 | virtual ~SEIWriter() {}; 48 | 49 | void writeSEImessage(TComBitIf& bs, const SEI& sei, TComSPS *sps); 50 | 51 | protected: 52 | Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps); 53 | Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei); 54 | Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei); 55 | Void xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, TComSPS *sps); 56 | Void xWriteSEIDecodedPictureHash(const SEIDecodedPictureHash& sei); 57 | Void xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, TComSPS *sps); 58 | Void xWriteSEIPictureTiming(const SEIPictureTiming& sei, TComSPS *sps); 59 | TComSPS *m_pSPS; 60 | Void xWriteSEIRecoveryPoint(const SEIRecoveryPoint& sei); 61 | Void xWriteSEIFramePacking(const SEIFramePacking& sei); 62 | Void xWriteSEIDisplayOrientation(const SEIDisplayOrientation &sei); 63 | Void xWriteSEITemporalLevel0Index(const SEITemporalLevel0Index &sei); 64 | Void xWriteSEIGradualDecodingRefreshInfo(const SEIGradualDecodingRefreshInfo &sei); 65 | Void xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei); 66 | Void xWriteSEISOPDescription(const SEISOPDescription& sei); 67 | Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps); 68 | Void xWriteByteAlign(); 69 | }; 70 | 71 | //! \} 72 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibEncoder/SyntaxElementWriter.cpp: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file SyntaxElementWriter.cpp 35 | \brief CAVLC encoder class 36 | */ 37 | 38 | #include "TLibCommon/CommonDef.h" 39 | #include "SyntaxElementWriter.h" 40 | 41 | //! \ingroup TLibEncoder 42 | //! \{ 43 | 44 | #if ENC_DEC_TRACE 45 | 46 | Void SyntaxElementWriter::xWriteCodeTr (UInt value, UInt length, const Char *pSymbolName) 47 | { 48 | xWriteCode (value,length); 49 | if( g_HLSTraceEnable ) 50 | { 51 | fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ ); 52 | if( length<10 ) 53 | { 54 | fprintf( g_hTrace, "%-50s u(%d) : %d\n", pSymbolName, length, value ); 55 | } 56 | else 57 | { 58 | fprintf( g_hTrace, "%-50s u(%d) : %d\n", pSymbolName, length, value ); 59 | } 60 | } 61 | } 62 | 63 | Void SyntaxElementWriter::xWriteUvlcTr (UInt value, const Char *pSymbolName) 64 | { 65 | xWriteUvlc (value); 66 | if( g_HLSTraceEnable ) 67 | { 68 | fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ ); 69 | fprintf( g_hTrace, "%-50s ue(v) : %d\n", pSymbolName, value ); 70 | } 71 | } 72 | 73 | Void SyntaxElementWriter::xWriteSvlcTr (Int value, const Char *pSymbolName) 74 | { 75 | xWriteSvlc(value); 76 | if( g_HLSTraceEnable ) 77 | { 78 | fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ ); 79 | fprintf( g_hTrace, "%-50s se(v) : %d\n", pSymbolName, value ); 80 | } 81 | } 82 | 83 | Void SyntaxElementWriter::xWriteFlagTr(UInt value, const Char *pSymbolName) 84 | { 85 | xWriteFlag(value); 86 | if( g_HLSTraceEnable ) 87 | { 88 | fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ ); 89 | fprintf( g_hTrace, "%-50s u(1) : %d\n", pSymbolName, value ); 90 | } 91 | } 92 | 93 | #endif 94 | 95 | 96 | Void SyntaxElementWriter::xWriteCode ( UInt uiCode, UInt uiLength ) 97 | { 98 | assert ( uiLength > 0 ); 99 | m_pcBitIf->write( uiCode, uiLength ); 100 | } 101 | 102 | Void SyntaxElementWriter::xWriteUvlc ( UInt uiCode ) 103 | { 104 | UInt uiLength = 1; 105 | UInt uiTemp = ++uiCode; 106 | 107 | assert ( uiTemp ); 108 | 109 | while( 1 != uiTemp ) 110 | { 111 | uiTemp >>= 1; 112 | uiLength += 2; 113 | } 114 | // Take care of cases where uiLength > 32 115 | m_pcBitIf->write( 0, uiLength >> 1); 116 | m_pcBitIf->write( uiCode, (uiLength+1) >> 1); 117 | } 118 | 119 | Void SyntaxElementWriter::xWriteSvlc ( Int iCode ) 120 | { 121 | UInt uiCode; 122 | 123 | uiCode = xConvertToUInt( iCode ); 124 | xWriteUvlc( uiCode ); 125 | } 126 | 127 | Void SyntaxElementWriter::xWriteFlag( UInt uiCode ) 128 | { 129 | m_pcBitIf->write( uiCode, 1 ); 130 | } 131 | 132 | //! \} 133 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibEncoder/SyntaxElementWriter.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file SyntaxElementWriter.h 35 | \brief CAVLC encoder class (header) 36 | */ 37 | 38 | #ifndef __SYNTAXELEMENTWRITER__ 39 | #define __SYNTAXELEMENTWRITER__ 40 | 41 | #if _MSC_VER > 1000 42 | #pragma once 43 | #endif // _MSC_VER > 1000 44 | 45 | #include "TLibCommon/CommonDef.h" 46 | #include "TLibCommon/TComBitStream.h" 47 | #include "TLibCommon/TComRom.h" 48 | 49 | //! \ingroup TLibEncoder 50 | //! \{ 51 | 52 | #if ENC_DEC_TRACE 53 | 54 | #define WRITE_CODE( value, length, name) xWriteCodeTr ( value, length, name ) 55 | #define WRITE_UVLC( value, name) xWriteUvlcTr ( value, name ) 56 | #define WRITE_SVLC( value, name) xWriteSvlcTr ( value, name ) 57 | #define WRITE_FLAG( value, name) xWriteFlagTr ( value, name ) 58 | 59 | #else 60 | 61 | #define WRITE_CODE( value, length, name) xWriteCode ( value, length ) 62 | #define WRITE_UVLC( value, name) xWriteUvlc ( value ) 63 | #define WRITE_SVLC( value, name) xWriteSvlc ( value ) 64 | #define WRITE_FLAG( value, name) xWriteFlag ( value ) 65 | 66 | #endif 67 | 68 | class SyntaxElementWriter 69 | { 70 | protected: 71 | TComBitIf* m_pcBitIf; 72 | 73 | SyntaxElementWriter() 74 | :m_pcBitIf(NULL) 75 | {}; 76 | virtual ~SyntaxElementWriter() {}; 77 | 78 | Void setBitstream ( TComBitIf* p ) { m_pcBitIf = p; } 79 | 80 | Void xWriteCode ( UInt uiCode, UInt uiLength ); 81 | Void xWriteUvlc ( UInt uiCode ); 82 | Void xWriteSvlc ( Int iCode ); 83 | Void xWriteFlag ( UInt uiCode ); 84 | #if ENC_DEC_TRACE 85 | Void xWriteCodeTr ( UInt value, UInt length, const Char *pSymbolName); 86 | Void xWriteUvlcTr ( UInt value, const Char *pSymbolName); 87 | Void xWriteSvlcTr ( Int value, const Char *pSymbolName); 88 | Void xWriteFlagTr ( UInt value, const Char *pSymbolName); 89 | #endif 90 | 91 | UInt xConvertToUInt ( Int iValue ) { return ( iValue <= 0) ? -iValue<<1 : (iValue<<1)-1; } 92 | }; 93 | 94 | //! \} 95 | 96 | #endif // !defined(__SYNTAXELEMENTWRITER__) 97 | 98 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibEncoder/TEncAnalyze.cpp: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TEncAnalyze.cpp 35 | \brief encoder analyzer class 36 | */ 37 | 38 | #include "TEncAnalyze.h" 39 | 40 | //! \ingroup TLibEncoder 41 | //! \{ 42 | 43 | ////////////////////////////////////////////////////////////////////// 44 | // Construction/Destruction 45 | ////////////////////////////////////////////////////////////////////// 46 | 47 | TEncAnalyze m_gcAnalyzeAll; 48 | TEncAnalyze m_gcAnalyzeI; 49 | TEncAnalyze m_gcAnalyzeP; 50 | TEncAnalyze m_gcAnalyzeB; 51 | 52 | TEncAnalyze m_gcAnalyzeAll_in; 53 | 54 | //! \} 55 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibEncoder/TEncBinCoder.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TEncBinCoder.h 35 | \brief binary entropy encoder interface 36 | */ 37 | 38 | #ifndef __TENC_BIN_CODER__ 39 | #define __TENC_BIN_CODER__ 40 | 41 | #include "TLibCommon/ContextModel.h" 42 | #include "TLibCommon/TComBitStream.h" 43 | 44 | //! \ingroup TLibEncoder 45 | //! \{ 46 | 47 | class TEncBinCABAC; 48 | 49 | class TEncBinIf 50 | { 51 | public: 52 | virtual Void init ( TComBitIf* pcTComBitIf ) = 0; 53 | virtual Void uninit () = 0; 54 | 55 | virtual Void start () = 0; 56 | virtual Void finish () = 0; 57 | virtual Void copyState ( TEncBinIf* pcTEncBinIf ) = 0; 58 | virtual Void flush () = 0; 59 | 60 | virtual Void resetBac () = 0; 61 | virtual Void encodePCMAlignBits() = 0; 62 | virtual Void xWritePCMCode ( UInt uiCode, UInt uiLength ) = 0; 63 | 64 | virtual Void resetBits () = 0; 65 | virtual UInt getNumWrittenBits () = 0; 66 | 67 | virtual Void encodeBin ( UInt uiBin, ContextModel& rcCtxModel ) = 0; 68 | virtual Void encodeBinEP ( UInt uiBin ) = 0; 69 | virtual Void encodeBinsEP ( UInt uiBins, Int numBins ) = 0; 70 | virtual Void encodeBinTrm ( UInt uiBin ) = 0; 71 | 72 | virtual TEncBinCABAC* getTEncBinCABAC () { return 0; } 73 | 74 | virtual ~TEncBinIf() {} 75 | }; 76 | 77 | //! \} 78 | 79 | #endif 80 | 81 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibEncoder/TEncBinCoderCABAC.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TEncBinCoderCABAC.h 35 | \brief binary entropy encoder of CABAC 36 | */ 37 | 38 | #ifndef __TENC_BIN_CODER_CABAC__ 39 | #define __TENC_BIN_CODER_CABAC__ 40 | 41 | #include "TLibCommon/TComCABACTables.h" 42 | #include "TEncBinCoder.h" 43 | 44 | //! \ingroup TLibEncoder 45 | //! \{ 46 | 47 | class TEncBinCABAC : public TEncBinIf 48 | { 49 | public: 50 | TEncBinCABAC (); 51 | virtual ~TEncBinCABAC(); 52 | 53 | Void init ( TComBitIf* pcTComBitIf ); 54 | Void uninit (); 55 | 56 | Void start (); 57 | Void finish (); 58 | Void copyState ( TEncBinIf* pcTEncBinIf ); 59 | Void flush (); 60 | 61 | Void resetBac (); 62 | Void encodePCMAlignBits(); 63 | Void xWritePCMCode ( UInt uiCode, UInt uiLength ); 64 | 65 | Void resetBits (); 66 | UInt getNumWrittenBits (); 67 | 68 | Void encodeBin ( UInt binValue, ContextModel& rcCtxModel ); 69 | Void encodeBinEP ( UInt binValue ); 70 | Void encodeBinsEP ( UInt binValues, Int numBins ); 71 | Void encodeBinTrm ( UInt binValue ); 72 | 73 | TEncBinCABAC* getTEncBinCABAC() { return this; } 74 | 75 | Void setBinsCoded ( UInt uiVal ) { m_uiBinsCoded = uiVal; } 76 | UInt getBinsCoded () { return m_uiBinsCoded; } 77 | Void setBinCountingEnableFlag ( Bool bFlag ) { m_binCountIncrement = bFlag ? 1 : 0; } 78 | Bool getBinCountingEnableFlag () { return m_binCountIncrement != 0; } 79 | 80 | #if FAST_BIT_EST 81 | protected: 82 | #else 83 | private: 84 | #endif 85 | Void testAndWriteOut(); 86 | Void writeOut(); 87 | 88 | TComBitIf* m_pcTComBitIf; 89 | UInt m_uiLow; 90 | UInt m_uiRange; 91 | UInt m_bufferedByte; 92 | Int m_numBufferedBytes; 93 | Int m_bitsLeft; 94 | UInt m_uiBinsCoded; 95 | Int m_binCountIncrement; 96 | #if FAST_BIT_EST 97 | UInt64 m_fracBits; 98 | #endif 99 | }; 100 | 101 | //! \} 102 | 103 | #endif 104 | 105 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibEncoder/TEncBinCoderCABACCounter.cpp: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TEncBinCoderCABAC.cpp 35 | \brief binary entropy encoder of CABAC 36 | */ 37 | 38 | #include "TEncBinCoderCABACCounter.h" 39 | #include "TLibCommon/TComRom.h" 40 | 41 | #if FAST_BIT_EST 42 | 43 | //! \ingroup TLibEncoder 44 | //! \{ 45 | 46 | 47 | TEncBinCABACCounter::TEncBinCABACCounter() 48 | { 49 | } 50 | 51 | TEncBinCABACCounter::~TEncBinCABACCounter() 52 | { 53 | } 54 | 55 | Void TEncBinCABACCounter::finish() 56 | { 57 | m_pcTComBitIf->write(0, UInt(m_fracBits >> 15) ); 58 | m_fracBits &= 32767; 59 | } 60 | 61 | UInt TEncBinCABACCounter::getNumWrittenBits() 62 | { 63 | return m_pcTComBitIf->getNumberOfWrittenBits() + UInt( m_fracBits >> 15 ); 64 | } 65 | 66 | /** 67 | * \brief Encode bin 68 | * 69 | * \param binValue bin value 70 | * \param rcCtxModel context model 71 | */ 72 | Void TEncBinCABACCounter::encodeBin( UInt binValue, ContextModel &rcCtxModel ) 73 | { 74 | m_uiBinsCoded += m_binCountIncrement; 75 | 76 | m_fracBits += rcCtxModel.getEntropyBits( binValue ); 77 | rcCtxModel.update( binValue ); 78 | } 79 | 80 | /** 81 | * \brief Encode equiprobable bin 82 | * 83 | * \param binValue bin value 84 | */ 85 | Void TEncBinCABACCounter::encodeBinEP( UInt binValue ) 86 | { 87 | m_uiBinsCoded += m_binCountIncrement; 88 | m_fracBits += 32768; 89 | } 90 | 91 | /** 92 | * \brief Encode equiprobable bins 93 | * 94 | * \param binValues bin values 95 | * \param numBins number of bins 96 | */ 97 | Void TEncBinCABACCounter::encodeBinsEP( UInt binValues, Int numBins ) 98 | { 99 | m_uiBinsCoded += numBins & -m_binCountIncrement; 100 | m_fracBits += 32768 * numBins; 101 | } 102 | 103 | /** 104 | * \brief Encode terminating bin 105 | * 106 | * \param binValue bin value 107 | */ 108 | Void TEncBinCABACCounter::encodeBinTrm( UInt binValue ) 109 | { 110 | m_uiBinsCoded += m_binCountIncrement; 111 | m_fracBits += ContextModel::getEntropyBitsTrm( binValue ); 112 | } 113 | 114 | //! \} 115 | #endif 116 | 117 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibEncoder/TEncBinCoderCABACCounter.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TEncBinCoderCABAC.h 35 | \brief binary entropy encoder of CABAC 36 | */ 37 | 38 | #ifndef __TENC_BIN_CODER_CABAC_COUNTER__ 39 | #define __TENC_BIN_CODER_CABAC_COUNTER__ 40 | 41 | 42 | #include "TEncBinCoderCABAC.h" 43 | 44 | #if FAST_BIT_EST 45 | 46 | //! \ingroup TLibEncoder 47 | //! \{ 48 | 49 | 50 | class TEncBinCABACCounter : public TEncBinCABAC 51 | { 52 | public: 53 | TEncBinCABACCounter (); 54 | virtual ~TEncBinCABACCounter(); 55 | 56 | Void finish (); 57 | UInt getNumWrittenBits (); 58 | 59 | Void encodeBin ( UInt binValue, ContextModel& rcCtxModel ); 60 | Void encodeBinEP ( UInt binValue ); 61 | Void encodeBinsEP ( UInt binValues, Int numBins ); 62 | Void encodeBinTrm ( UInt binValue ); 63 | 64 | private: 65 | }; 66 | 67 | //! \} 68 | 69 | #endif 70 | 71 | #endif 72 | 73 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibEncoder/TEncPreanalyzer.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TEncPreanalyzer.h 35 | \brief source picture analyzer class (header) 36 | */ 37 | 38 | #ifndef __TENCPREANALYZER__ 39 | #define __TENCPREANALYZER__ 40 | 41 | #include "TEncPic.h" 42 | 43 | //! \ingroup TLibEncoder 44 | //! \{ 45 | 46 | // ==================================================================================================================== 47 | // Class definition 48 | // ==================================================================================================================== 49 | 50 | /// Source picture analyzer class 51 | class TEncPreanalyzer 52 | { 53 | public: 54 | TEncPreanalyzer(); 55 | virtual ~TEncPreanalyzer(); 56 | 57 | Void xPreanalyze( TEncPic* pcPic ); 58 | }; 59 | 60 | //! \} 61 | 62 | #endif // __TENCPREANALYZER__ 63 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibEncoder/WeightPredAnalysis.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file WeightPredAnalysis.h 35 | \brief weighted prediction encoder class 36 | */ 37 | #ifndef __WEIGHTPREDANALYSIS__ 38 | #define __WEIGHTPREDANALYSIS__ 39 | 40 | #include "../TLibCommon/TypeDef.h" 41 | #include "../TLibCommon/TComSlice.h" 42 | #include "TEncCavlc.h" 43 | 44 | class WeightPredAnalysis 45 | { 46 | Bool m_weighted_pred_flag; 47 | Bool m_weighted_bipred_flag; 48 | wpScalingParam m_wp[2][MAX_NUM_REF][3]; 49 | 50 | Int64 xCalcDCValueSlice(TComSlice *slice, Pel *pPel,Int *iSample); 51 | Int64 xCalcACValueSlice(TComSlice *slice, Pel *pPel, Int64 iDC); 52 | Int64 xCalcDCValueUVSlice(TComSlice *slice, Pel *pPel, Int *iSample); 53 | Int64 xCalcACValueUVSlice(TComSlice *slice, Pel *pPel, Int64 iDC); 54 | Int64 xCalcSADvalueWPSlice(TComSlice *slice, Pel *pOrgPel, Pel *pRefPel, Int iDenom, Int iWeight, Int iOffset); 55 | 56 | Int64 xCalcDCValue(Pel *pPel, Int iWidth, Int iHeight, Int iStride); 57 | Int64 xCalcACValue(Pel *pPel, Int iWidth, Int iHeight, Int iStride, Int64 iDC); 58 | Int64 xCalcSADvalueWP(Int bitDepth, Pel *pOrgPel, Pel *pRefPel, Int iWidth, Int iHeight, Int iOrgStride, Int iRefStride, Int iDenom, Int iWeight, Int iOffset); 59 | Bool xSelectWP(TComSlice *slice, wpScalingParam weightPredTable[2][MAX_NUM_REF][3], Int iDenom); 60 | Bool xUpdatingWPParameters(TComSlice *slice, wpScalingParam weightPredTable[2][MAX_NUM_REF][3], Int log2Denom); 61 | 62 | public: 63 | 64 | WeightPredAnalysis(); 65 | 66 | // WP analysis : 67 | Bool xCalcACDCParamSlice(TComSlice *slice); 68 | Bool xEstimateWPParamSlice(TComSlice *slice); 69 | Void xStoreWPparam(Bool weighted_pred_flag, Bool weighted_bipred_flag); 70 | Void xRestoreWPparam(TComSlice *slice); 71 | Void xCheckWPEnable(TComSlice *slice); 72 | }; 73 | 74 | #endif // __WEIGHTPREDANALYSIS__ 75 | 76 | 77 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/TLibVideoIO/TVideoIOYuv.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** \file TVideoIOYuv.h 35 | \brief YUV file I/O class (header) 36 | */ 37 | 38 | #ifndef __TVIDEOIOYUV__ 39 | #define __TVIDEOIOYUV__ 40 | 41 | #include 42 | #include 43 | #include 44 | #include "TLibCommon/CommonDef.h" 45 | #include "TLibCommon/TComPicYuv.h" 46 | 47 | using namespace std; 48 | 49 | // ==================================================================================================================== 50 | // Class definition 51 | // ==================================================================================================================== 52 | 53 | /// YUV file I/O class 54 | class TVideoIOYuv 55 | { 56 | private: 57 | fstream m_cHandle; ///< file handle 58 | Int m_fileBitDepthY; ///< bitdepth of input/output video file luma component 59 | Int m_fileBitDepthC; ///< bitdepth of input/output video file chroma component 60 | Int m_bitDepthShiftY; ///< number of bits to increase or decrease luma by before/after write/read 61 | Int m_bitDepthShiftC; ///< number of bits to increase or decrease chroma by before/after write/read 62 | 63 | public: 64 | TVideoIOYuv() {} 65 | virtual ~TVideoIOYuv() {} 66 | 67 | Void open ( Char* pchFile, Bool bWriteMode, Int fileBitDepthY, Int fileBitDepthC, Int internalBitDepthY, Int internalBitDepthC ); ///< open or create file 68 | Void close (); ///< close file 69 | 70 | void skipFrames(UInt numFrames, UInt width, UInt height); 71 | 72 | Bool read ( TComPicYuv* pPicYuv, Int aiPad[2] ); ///< read one YUV frame with padding parameter 73 | Bool write( TComPicYuv* pPicYuv, Int confLeft=0, Int confRight=0, Int confTop=0, Int confBottom=0 ); 74 | Bool write( TComPicYuv* pPicYuv, TComPicYuv* pPicYuv2, Int confLeft=0, Int confRight=0, Int confTop=0, Int confBottom=0 , bool isTff=false); 75 | 76 | Bool isEof (); ///< check for end-of-file 77 | Bool isFail(); ///< check for failure 78 | 79 | }; 80 | 81 | #endif // __TVIDEOIOYUV__ 82 | 83 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/libmd5/MD5.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | #pragma once 34 | #include "libmd5.h" 35 | 36 | //! \ingroup libMD5 37 | //! \{ 38 | 39 | class MD5 40 | { 41 | public: 42 | /** 43 | * initialize digest state 44 | */ 45 | MD5() 46 | { 47 | MD5Init(&m_state); 48 | } 49 | 50 | /** 51 | * compute digest over buf of length len. 52 | * multiple calls may extend the digest over more data. 53 | */ 54 | void update(unsigned char *buf, unsigned len) 55 | { 56 | MD5Update(&m_state, buf, len); 57 | } 58 | 59 | /** 60 | * flush any outstanding MD5 data, write the digest into digest. 61 | */ 62 | void finalize(unsigned char digest[16]) 63 | { 64 | MD5Final(digest, &m_state); 65 | } 66 | 67 | private: 68 | context_md5_t m_state; 69 | }; 70 | 71 | 72 | /** 73 | * Produce an ascii(hex) representation of picture digest. 74 | * 75 | * Returns: a statically allocated null-terminated string. DO NOT FREE. 76 | */ 77 | inline const char* 78 | digestToString(const unsigned char digest[3][16], int numChar) 79 | { 80 | const char* hex = "0123456789abcdef"; 81 | static char string[99]; 82 | int cnt=0; 83 | for(int yuvIdx=0; yuvIdx<3; yuvIdx++) 84 | { 85 | for (int i = 0; i < numChar; i++) 86 | { 87 | string[cnt++] = hex[digest[yuvIdx][i] >> 4]; 88 | string[cnt++] = hex[digest[yuvIdx][i] & 0xf]; 89 | } 90 | string[cnt++] = ','; 91 | } 92 | 93 | string[cnt-1] = '\0'; 94 | return string; 95 | } 96 | //! \} 97 | -------------------------------------------------------------------------------- /hm-14.0/source/Lib/libmd5/libmd5.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | * License, included below. This software may be subject to other third party 3 | * and contributor rights, including patent rights, and no such rights are 4 | * granted under this license. 5 | * 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 | * be used to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | * THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | #pragma once 34 | #include 35 | 36 | //! \ingroup libMD5 37 | //! \{ 38 | 39 | typedef struct _context_md5_t { 40 | uint32_t buf[4]; 41 | uint32_t bits[2]; 42 | union { 43 | unsigned char b8[64]; 44 | uint32_t b32[16]; 45 | } in; 46 | } context_md5_t; 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | void MD5Init(context_md5_t *ctx); 52 | void MD5Update(context_md5_t *ctx, unsigned char *buf, unsigned len); 53 | void MD5Final(unsigned char digest[16], context_md5_t *ctx); 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | //! \} 59 | -------------------------------------------------------------------------------- /matlab/filterPrediction.m: -------------------------------------------------------------------------------- 1 | function [filter_pred_mtx] = filterPrediction( block_size, pred_mtx, iteration, kernel ) 2 | 3 | N_ext = block_size^2 + 4 * block_size + 1; 4 | 5 | filter_mtx = zeros( N_ext, N_ext ); 6 | 7 | % ====== generate mapping from block to vector ====== 8 | map_size = 2 * block_size + 1; 9 | order_map = zeros( map_size, map_size ); 10 | count = 0; 11 | for y = 1 : map_size 12 | count = count + 1; 13 | order_map(y, 1) = count; 14 | end 15 | for x = 2 : map_size 16 | count = count + 1; 17 | order_map(1, x) = count; 18 | end 19 | for x = 2 : block_size + 1 20 | for y = 2 : block_size + 1 21 | count = count + 1; 22 | order_map( y, x ) = count; 23 | end 24 | end 25 | 26 | 27 | % ====== assign prediction weights ====== 28 | 29 | for i = 1 : 1 + 4 * block_size 30 | filter_mtx(i, i) = 1; 31 | end 32 | 33 | kernel_size = size(kernel, 1); 34 | 35 | if ( sum(sum((abs(kernel)))) == 0 ) 36 | kernel = ones(kernel_size, kernel_size); 37 | end 38 | 39 | for y = 2 : block_size + 1 40 | for x = 2 : block_size + 1 41 | sum_kernel = 0; 42 | for off_y = - floor(kernel_size/2) : floor(kernel_size/2) 43 | for off_x = - floor(kernel_size/2) : floor(kernel_size/2) 44 | if (y + off_y < 1 || y + off_y > block_size + 1 || x + off_x < 1 || x + off_x > block_size + 1) 45 | continue; 46 | end 47 | sum_kernel = sum_kernel + kernel(off_y + floor(kernel_size/2) + 1, off_x + floor(kernel_size/2) + 1); 48 | end 49 | end 50 | 51 | for off_y = - floor(kernel_size/2) : floor(kernel_size/2) 52 | for off_x = - floor(kernel_size/2) : floor(kernel_size/2) 53 | if (y + off_y < 1 || y + off_y > block_size + 1 || x + off_x < 1 || x + off_x > block_size + 1) 54 | continue; 55 | end 56 | filter_mtx( order_map(y, x), order_map(y + off_y, x + off_x) ) = ... 57 | kernel(off_y + floor(kernel_size/2) + 1, off_x + floor(kernel_size/2) + 1)/sum_kernel; 58 | end 59 | end 60 | end 61 | end 62 | 63 | % ====== apply the filter ====== 64 | 65 | filter_pred_mtx = filter_mtx^iteration * pred_mtx; -------------------------------------------------------------------------------- /matlab/getHevcRefIdx.m: -------------------------------------------------------------------------------- 1 | % This function is to get the index of pixels for HEVC intra mode. 2 | % 3 | % Input: 4 | % width: size of the block, e.g., 4 for 4x4 block, 8 for 8x8 block. 5 | % predIntraMode: intra prediction mode in HEVC (34 mode). 6 | % Output: 7 | % ref_indices: 1-D vector of index of pixels for |predIntraMode|. 8 | % 9 | function ref_indices = getHevcRefIdx( width, predIntraMode ) 10 | 11 | if ( predIntraMode == 1) 12 | ref_indices = [ 1: width + 1, 2 * width + 2 : 3 * width + 1 ]; 13 | return; 14 | end 15 | 16 | if ( predIntraMode <= 10) 17 | ref_indices = 1 : 3 * width + 1; 18 | elseif ( predIntraMode >= 26) 19 | ref_indices = [ 1 : width + 1, 2 * width + 2 : 4 * width + 1 ]; 20 | else 21 | ref_indices = 1 : 4 * width + 1; 22 | end 23 | end -------------------------------------------------------------------------------- /matlab/getOptimalPredictionWeights.m: -------------------------------------------------------------------------------- 1 | % This function is to get the optimal weights for the prediction in a 2 | % mse sense. This method is based on Jayant's "Digital Coding of Waveforms" 3 | % page 269 4 | % 5 | % Input: 6 | % cov_mtx_ext: covariance matrix (assuming zero-mean) 7 | % ref_indices: indices of the references points 8 | % pred_index: the index of the to-be-predicted point 9 | % Output: 10 | % opt_weights: optimal weights 11 | % 12 | 13 | 14 | function [opt_weights] = getOptimalPredictionWeights(cov_mtx_ext, ref_indices, pred_index) 15 | 16 | rxx = cov_mtx_ext(ref_indices, pred_index); 17 | 18 | Rxx = cov_mtx_ext(ref_indices, ref_indices); 19 | 20 | opt_weights = inv(Rxx) * rxx; 21 | 22 | end -------------------------------------------------------------------------------- /matlab/journal_figure1.m: -------------------------------------------------------------------------------- 1 | clear; 2 | clc; 3 | 4 | % ====== parameters ====== 5 | rho = 0.95; 6 | sigma = 0.0; % quantization noise 7 | arrCG_resi_opt = []; 8 | arrCG_resi_copy = []; 9 | 10 | % optimal 11 | for N = 4 : 32 12 | % ====== generate covariance matrix ====== 13 | cov_mtx_ext = zeros( N + 1, N + 1 ); 14 | cov_mtx = zeros( N, N ); 15 | pred_mtx = eye( N + 1 ); 16 | resi_cov_mtx_ext = zeros( N + 1, N + 1 ); 17 | resi_cov_mtx = zeros( N, N ); 18 | for i = 1 : N + 1 19 | for j = 1 : N + 1 20 | cov_mtx_ext(i, j) = rho^(abs(i - j)); 21 | end 22 | end 23 | cov_mtx_ext(1, 1) = cov_mtx_ext(1, 1) + sigma ^ 2; 24 | 25 | % ====== apply prediction matrix ====== 26 | pred_mtx(1, 1) = 0; 27 | 28 | % ======= optimal prediction weight ======= 29 | pred_mtx( 2 : N + 1, 1 ) = -rho.^(1 : N)/(1+sigma^2); 30 | 31 | resi_cov_mtx_ext = pred_mtx * cov_mtx_ext * pred_mtx'; 32 | resi_cov_mtx = resi_cov_mtx_ext( 2 : N + 1, 2 : N + 1 ); 33 | CG = -10*(sum(log10(diag(resi_cov_mtx))))/N; 34 | arrCG_resi_opt = [arrCG_resi_opt CG]; 35 | 36 | % copying-based 37 | % ====== apply prediction matrix ====== 38 | pred_mtx(1, 1) = 0; 39 | 40 | % ======= optimal prediction weight ======= 41 | pred_mtx( 2 : N + 1, 1 ) = -1; 42 | 43 | resi_cov_mtx_ext = pred_mtx * cov_mtx_ext * pred_mtx'; 44 | resi_cov_mtx = resi_cov_mtx_ext( 2 : N + 1, 2 : N + 1 ); 45 | CG = -10*(sum(log10(diag(resi_cov_mtx))))/N; 46 | arrCG_resi_copy = [arrCG_resi_copy CG]; 47 | end 48 | 49 | 50 | h1 = plot(4 : 32, arrCG_resi_opt, '-^k'); hold on; 51 | h2 = plot(4 : 32, arrCG_resi_copy, 'r'); hold on; 52 | h_legend = legend('Optimal weights in Eq. (6)', 'Copying-based'); 53 | h_xl = xlabel('N (Number of samples)'); 54 | h_yl = ylabel('Coding gain (dB)'); 55 | grid on; 56 | 57 | set(h1, 'LineWidth', 1.5); 58 | set(h2, 'LineWidth', 1.5); 59 | set(h_legend, 'FontSize', 15); 60 | set(h_xl, 'FontSize', 15); 61 | set(h_yl, 'FontSize', 15); 62 | set(gca,'FontSize', 12); 63 | grid on; -------------------------------------------------------------------------------- /matlab/journal_figure2.m: -------------------------------------------------------------------------------- 1 | clear; 2 | clc; 3 | 4 | % ====== parameters ====== 5 | rho = 0.95; 6 | N = 8; 7 | sigma = 0.0; % quantization noise 8 | arrCG_resi_opt = []; 9 | arrCG_resi_opt_error = []; 10 | arrCG_resi_copy = []; 11 | 12 | % optimal 13 | for sigma = 0 : 0.05 : 0.5 14 | % ====== generate covariance matrix ====== 15 | cov_mtx_ext = zeros( N + 1, N + 1 ); 16 | cov_mtx = zeros( N, N ); 17 | pred_mtx = eye( N + 1 ); 18 | resi_cov_mtx_ext = zeros( N + 1, N + 1 ); 19 | resi_cov_mtx = zeros( N, N ); 20 | for i = 1 : N + 1 21 | for j = 1 : N + 1 22 | cov_mtx_ext(i, j) = rho^(abs(i - j)); 23 | end 24 | end 25 | cov_mtx_ext(1, 1) = cov_mtx_ext(1, 1) + sigma ^ 2; 26 | 27 | % ====== apply prediction matrix ====== 28 | pred_mtx(1, 1) = 0; 29 | 30 | % ======= prediction weight (optimal w/o error) ======= 31 | pred_mtx( 2 : N + 1, 1 ) = -rho.^(1 : N); 32 | resi_cov_mtx_ext = pred_mtx * cov_mtx_ext * pred_mtx'; 33 | resi_cov_mtx = resi_cov_mtx_ext( 2 : N + 1, 2 : N + 1 ); 34 | CG = -10*(sum(log10(diag(resi_cov_mtx))))/N; 35 | arrCG_resi_opt = [arrCG_resi_opt CG]; 36 | 37 | 38 | pred_mtx(1, 1) = 0; 39 | % ======= prediction weight (optimal w/ error) ======= 40 | pred_mtx( 2 : N + 1, 1 ) = -rho.^(1 : N)/(1+sigma^2); 41 | 42 | resi_cov_mtx_ext = pred_mtx * cov_mtx_ext * pred_mtx'; 43 | resi_cov_mtx = resi_cov_mtx_ext( 2 : N + 1, 2 : N + 1 ); 44 | CG = -10*(sum(log10(diag(resi_cov_mtx))))/N; 45 | arrCG_resi_opt_error = [arrCG_resi_opt_error CG]; 46 | 47 | % copying-based 48 | % ====== apply prediction matrix ====== 49 | pred_mtx(1, 1) = 0; 50 | 51 | % ======= prediction weight (optimal) ======= 52 | pred_mtx( 2 : N + 1, 1 ) = -1; 53 | 54 | resi_cov_mtx_ext = pred_mtx * cov_mtx_ext * pred_mtx'; 55 | resi_cov_mtx = resi_cov_mtx_ext( 2 : N + 1, 2 : N + 1 ); 56 | CG = -10*(sum(log10(diag(resi_cov_mtx))))/N; 57 | arrCG_resi_copy = [arrCG_resi_copy CG]; 58 | end 59 | 60 | h0 = plot(0 : 0.05 : 0.5, arrCG_resi_opt_error, '-vb'); hold on; 61 | h1 = plot(0 : 0.05 : 0.5, arrCG_resi_opt, '-^k'); hold on; 62 | h2 = plot(0 : 0.05 : 0.5, arrCG_resi_copy, 'r'); hold on; 63 | h_legend = legend('Optimal weights in Eq. (14)', 'Optimal weights in Eq. (6)', 'Copying-based'); 64 | h_xl = xlabel('\sigma (reference deviation)'); 65 | h_yl = ylabel('Coding gain (dB)'); 66 | grid on; 67 | 68 | set(h0, 'LineWidth', 1.5); 69 | set(h1, 'LineWidth', 1.5); 70 | set(h2, 'LineWidth', 1.5); 71 | set(h_legend, 'FontSize', 15); 72 | set(h_xl, 'FontSize', 15); 73 | set(h_yl, 'FontSize', 15); 74 | set(gca,'FontSize', 12); 75 | grid on; -------------------------------------------------------------------------------- /matlab/journal_figure6.m: -------------------------------------------------------------------------------- 1 | clear; 2 | clc; 3 | 4 | % ====== parameters ====== 5 | rho = 0.99; % correlation along dominating direction 6 | rho2 = rho^5; % correlation perpendicular to dominating direction 7 | sigmaSet = [0 0.2 0.5]; % quantization error 8 | etaList = [1 log(rho2)/log(rho)] % stength 9 | isHEVC = 0; 10 | modeSet = 10; 11 | width = 4; 12 | kernel = [0 1/6 0; 1/6 1/3 1/6; 0 1/6 0]; 13 | 14 | lineStyleSet = {'-k', '--r', ':b', '-*'}; 15 | 16 | for column = 1 : 4 17 | for row = 1 : 4 18 | posInVector = width * 4 + 1 + (column - 1) * width + row; 19 | 20 | subplot(4,4, row * 4 - 4 + column) 21 | 22 | weightsRecord = zeros(width * 4 + 1, size(sigmaSet, 1)); 23 | count = 0; 24 | legendInfo = {}; 25 | 26 | for sigma = sigmaSet 27 | count = count + 1; 28 | 29 | N = width ^ 2; 30 | N_ext = N + width * 4 + 1; 31 | 32 | % ====== optimal prediction ====== 33 | for predModeIntra = modeSet 34 | 35 | % ====== mode-dependent parameters ====== 36 | if (predModeIntra == 1) 37 | eta = 1; 38 | alpha = 0; 39 | else 40 | eta = etaList(2); 41 | alpha = (10 - predModeIntra) / 32 * pi; 42 | end 43 | 44 | % ====== generate covariance matrix ====== 45 | [pred_mtx, cov_mtx_ext] = getHevcIntraPredAndExtCovMtx( width, predModeIntra, rho, alpha, eta, sigma, ~isHEVC); 46 | 47 | % ====== filtering prediction ====== 48 | filter_pred_mtx = filterPrediction( width, pred_mtx, 5, kernel ); 49 | 50 | % permutate the reference pixels 51 | permutMtx = eye(N_ext); 52 | 53 | for i = 1 : 2 * width + 1 54 | permutMtx(i, i) = 0; 55 | permutMtx(i, 2 * width + 2 - i) = 1; 56 | end 57 | 58 | cov_mtx_ext = permutMtx * cov_mtx_ext * permutMtx'; 59 | 60 | filter_pred_mtx = filter_pred_mtx * inv(permutMtx); 61 | 62 | % ====== get optimal pred_mtx (both no-error and error cases) ====== 63 | opt_pred_mtx = zeros(size(pred_mtx)); 64 | 65 | ref_indices = 1 : (N_ext - N); 66 | for i = posInVector 67 | 68 | % optimal weights 69 | opt_weights = getOptimalPredictionWeights(cov_mtx_ext, ref_indices, i); 70 | 71 | % normalize to 1 and compensate other weights 72 | opt_weights = (1 - sum(opt_weights))/size(opt_weights, 1) * ones(size(opt_weights, 1), 1) + opt_weights; 73 | 74 | opt_pred_mtx(i, ref_indices) = opt_weights; 75 | 76 | weightsRecord(:, count) = opt_weights; 77 | end 78 | end 79 | 80 | % Visualize weights vs samples 81 | plot(1 : (N_ext - N), opt_pred_mtx(i, 1 : (N_ext - N)), [lineStyleSet{count}], 'LineWidth', 1.5); hold on; 82 | legendInfo{count} = ['\sigma = ' num2str(sigma) ]; 83 | h_title = title( ['x_{' num2str(row) ',' num2str(column) '}'] ); 84 | axis([1 17 -0.1 1]); 85 | h_xlabel = xlabel('reference pixels'); 86 | h_ylabel = ylabel('weights'); 87 | grid on; 88 | 89 | set(h_title, 'FontSize', 15, 'FontName','Times New Roman'); 90 | set(h_xlabel, 'FontSize', 15, 'FontName','Times New Roman'); 91 | set(h_ylabel, 'FontSize', 15, 'FontName','Times New Roman'); 92 | end 93 | 94 | h_legend = legend(legendInfo); 95 | set(h_legend, 'FontName','Times New Roman', 'FontSize', 10, ... 96 | 'FontName','Times New Roman'); 97 | set(gca,'FontSize', 12, 'FontName','Times New Roman'); 98 | 99 | end 100 | end --------------------------------------------------------------------------------