之前的文章,我们介绍了如何在windows10上下载并调试HM16.20,这里我们介绍如何在Ubuntu上下载调试HM16.20。
下载
我们已经知道了HM通过SVN(subversion)管理代码,所以这里我们首先安装subversion
sudo apt-get install subverison
安装完成后,输入下面的命令查看是否安装成功
subserve --version
然后在本地新建一个空文件夹,命名为HM_1620_dmap
,输入如下命令安装HM16.20
$ svnserve -d -r ./ # 指定SVN在本机服务器的位置
$ svn checkout https://hevc.hhi.fraunhofer.de/svn/svn_HEVCSoftware/tags/HM-16.20+SCM-8.8/
编译
-
首先需要进入
HM-16.20+SCM-8.8/build/linux/common
文件夹下,将makefile.base
中的-Werror
删除,否则无法编译这里介绍一下如何在
vim
中搜索字符串:在Normal Mode下键入/
,即可进入搜索模式,输入搜索关键词然后回车,即可跳转到第一个匹配的单词,按下n
,会跳转到下一个匹配的单词,按下N
(shift
+n
)可以跳转到上一个匹配的单词。更多关于高亮显示、大小写敏感和替换操作,参考vim的搜索与替换 - 知乎 (zhihu.com)。
:set hlsearch
/-Werror
- 进入
HM-16.20+SCM-8.8/build/linux
下,输入命令make
,即可完成编译
运行
进入HM-16.20+SCM-8.8/bin
目录下,输入./TAppEncoderStatic -help
即可查看如何运行程序
可见,Linux的运行方式和VS属性页中的配置命令基本一致,我们还需要配置属性文件,这里我们采用和windows相同的配置方法——在项目目录下新建workspace/
作为工作空间,按照日期创建测试文件夹,这里是22_0127/
,并从cfg/
下拷贝一份属性页encoder_intra_main.cfg
,为了加快编码时间,修改QP
为最高等级51,其余参数不变,如下所示
#======== File I/O =====================
BitstreamFile : str.bin
ReconFile : rec.yuv
#======== Profile ================
Profile : main
#======== Unit definition ================
MaxCUWidth : 64 # Maximum coding unit width in pixel
MaxCUHeight : 64 # Maximum coding unit height in pixel
MaxPartitionDepth : 4 # Maximum coding unit depth
QuadtreeTULog2MaxSize : 5 # Log2 of maximum transform size for
# quadtree-based TU coding (2...6)
QuadtreeTULog2MinSize : 2 # Log2 of minimum transform size for
# quadtree-based TU coding (2...6)
QuadtreeTUMaxDepthInter : 3
QuadtreeTUMaxDepthIntra : 3
#======== Coding Structure =============
IntraPeriod : 1 # Period of I-Frame ( -1 = only first)
DecodingRefreshType : 1 # Random Accesss 0:none, 1:CRA, 2:IDR, 3:Recovery Point SEI
GOPSize : 1 # GOP Size (number of B slice = GOPSize-1)
ReWriteParamSetsFlag : 1 # Write parameter sets with every IRAP
#=========== Motion Search =============
FastSearch : 1 # 0:Full search 1:TZ search
SearchRange : 64 # (0: Search range is a Full frame)
HadamardME : 1 # Use of hadamard measure for fractional ME
FEN : 1 # Fast encoder decision
FDM : 1 # Fast Decision for Merge RD cost
#======== Quantization =============
QP : 51 # Quantization parameter(0-51)
MaxDeltaQP : 0 # CU-based multi-QP optimization
MaxCuDQPDepth : 0 # Max depth of a minimum CuDQP for sub-LCU-level delta QP
DeltaQpRD : 0 # Slice-based multi-QP optimization
RDOQ : 1 # RDOQ
RDOQTS : 1 # RDOQ for transform skip
#=========== Deblock Filter ============
LoopFilterOffsetInPPS : 1 # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1 (default) =constant params in PPS, param = base_param)
LoopFilterDisable : 0 # Disable deblocking filter (0=Filter, 1=No Filter)
LoopFilterBetaOffset_div2 : 0 # base_param: -6 ~ 6
LoopFilterTcOffset_div2 : 0 # base_param: -6 ~ 6
DeblockingFilterMetric : 0 # blockiness metric (automatically configures deblocking parameters in bitstream). Applies slice-level loop filter offsets (LoopFilterOffsetInPPS and LoopFilterDisable must be 0)
#=========== Misc. ============
InternalBitDepth : 8 # codec operating bit-depth
#=========== Coding Tools =================
SAO : 1 # Sample adaptive offset (0: OFF, 1: ON)
AMP : 1 # Asymmetric motion partitions (0: OFF, 1: ON)
TransformSkip : 1 # Transform skipping (0: OFF, 1: ON)
TransformSkipFast : 1 # Fast Transform skipping (0: OFF, 1: ON)
SAOLcuBoundary : 0 # SAOLcuBoundary using non-deblocked pixels (0: OFF, 1: ON)
#============ Slices ================
SliceMode : 0 # 0: Disable all slice options.
# 1: Enforce maximum number of LCU in an slice,
# 2: Enforce maximum number of bytes in an 'slice'
# 3: Enforce maximum number of tiles in a slice
SliceArgument : 1500 # Argument for 'SliceMode'.
# If SliceMode==1 it represents max. SliceGranularity-sized blocks per slice.
# If SliceMode==2 it represents max. bytes per slice.
# If SliceMode==3 it represents max. tiles per slice.
LFCrossSliceBoundaryFlag : 1 # In-loop filtering, including ALF and DB, is across or not across slice boundary.
# 0:not across, 1: across
#============ PCM ================
PCMEnabledFlag : 0 # 0: No PCM mode
PCMLog2MaxSize : 5 # Log2 of maximum PCM block size.
PCMLog2MinSize : 3 # Log2 of minimum PCM block size.
PCMInputBitDepthFlag : 1 # 0: PCM bit-depth is internal bit-depth. 1: PCM bit-depth is input bit-depth.
PCMFilterDisableFlag : 0 # 0: Enable loop filtering on I_PCM samples. 1: Disable loop filtering on I_PCM samples.
#============ Tiles ================
TileUniformSpacing : 0 # 0: the column boundaries are indicated by TileColumnWidth array, the row boundaries are indicated by TileRowHeight array
# 1: the column and row boundaries are distributed uniformly
NumTileColumnsMinus1 : 0 # Number of tile columns in a picture minus 1
TileColumnWidthArray : 2 3 # Array containing tile column width values in units of CTU (from left to right in picture)
NumTileRowsMinus1 : 0 # Number of tile rows in a picture minus 1
TileRowHeightArray : 2 # Array containing tile row height values in units of CTU (from top to bottom in picture)
LFCrossTileBoundaryFlag : 1 # In-loop filtering is across or not across tile boundary.
# 0:not across, 1: across
#============ WaveFront ================
WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case).
# >0: WaveFront synchronises with the LCU above and to the right by this many LCUs.
#=========== Quantization Matrix =================
ScalingList : 0 # ScalingList 0 : off, 1 : default, 2 : file read
ScalingListFile : scaling_list.txt # Scaling List file name. If file is not exist, use Default Matrix.
#============ Lossless ================
TransquantBypassEnable : 0 # Value of PPS flag.
CUTransquantBypassFlagForce: 0 # Force transquant bypass mode, when transquant_bypass_enable_flag is enabled
### DO NOT ADD ANYTHING BELOW THIS LINE ###
### DO NOT DELETE THE EMPTY LINE BELOW ###
并在当前文件夹下新建sintel.cfg
,用于指定需要处理的序列文件和参数
#======== File I/O ===============
InputFile : sintel_640_360.yuv
InputBitDepth : 8 # Input bitdepth
InputChromaFormat : 420 # Ratio of luminance to chrominance samples
FrameRate : 50 # Frame Rate per second
FrameSkip : 0 # Number of frames to be skipped in input
SourceWidth : 640 # Input frame width
SourceHeight : 360 # Input frame height
FramesToBeEncoded : 5 # Number of frames to be coded
Level : 2.1
YUV文件从官网下载Index of /hevc/hm-15.0-anchors/bitstreams/i_main/,或者从百度云下载
链接:https://pan.baidu.com/s/1wEVowxJTX-gPdhPlsi2FbQ
提取码:ryhv
当然,你也可以用xshell或vscode+sftp将本地文件上传到服务器。
万事大吉,我们
开始运行编码器
../../bin/TAppEncoderStatic -c encoder_intra_main.cfg -c sintel.cfg
此时,测试文件夹下面就有了重建的YUV数据rec.yuv
和需要传输的二进制文件str.bin
。
Reference
[1] 在ubuntu下编译运行HEVC参考软件HM-16.20
[3] Ubuntu快速下载百度云文件