###Date: 2018.5.20
================================================================
分类:AVS视频编解码
1、AVS1标准介绍和参考代码RM下载
AVS1标准是中国自主研发的音视频编解码标准,主要用于国内卫星电视的压缩传输,其压缩率相较于H.264要低一些,在使用范围和推广上也不如H.264。
AVS1标准参考代码RM下载地址:https://download.csdn.net/download/soaringlee_fighting/10425909
2、AVS1参考代码RM在Windows下编译
编译方法很简单,打开RM.dsw,分别运行lencod.dsw和ldecod.dsw即可。
编码后的avs码流为test.avs,当然可以在encoder.cfg配置文件中进行设置。编码重建yuv为test_rec.yuv。
解码yuv为test_dec.yuv。
编码过程如下图所示:
(场编码)
(帧编码)
解码过程如下图所示:
解码yuv:
3、AVS1编解码器的使用方法(命令行参数)
AVS1编码器生成在bin下面为lencod.exe
lencod.exe [-f file] [-p parameter=value]
-f file If an -f <config> parameter is present in the command line then the parameters will be taken from the config file See configfile.h for a list of supported ParameterNames. -p parameter=value If -p <ParameterName = ParameterValue> parameters are present then the ParameterValue will overide the config file's settings. There must be whitespace between -f and -p commands and their respecitive parameters.
AVS1解码器生成在bin下面为ldecod.exe
ldecod.exe decoder.cfg
The decoder configuration file name must be provided as the first parameter. All decoding parameters are read from this file.
编码器配置文件encoder.cfg:
# New Input File Format is as follows # <ParameterName> = <ParameterValue> # Comment # See configfile.h for a list of supported ParameterNames ########################################################################################## # Files ########################################################################################## InputFile = "E:\origCfP\BasketballPass_416x240_50.yuv" # Input sequence, YUV 4:2:0 InputHeaderLength = 0 # If the inputfile has a header, state it's length in byte here FramesToBeEncoded = 10 # Number of frames to be coded SourceWidth = 416 # Image width in Pels, must be multiple of 16 SourceHeight = 240 # Image height in Pels, must be multiple of 16 TraceFile = "trace_enc.txt" ReconFile = "test_rec.yuv" OutputFile = "test.avs" ########################################################################################## # Encoder Control ########################################################################################## ProfileID = 32 # Profile ID (32: Jizhun Profile) LevelID = 64 # Level ID (16: 2.0; 32: 4.0; 34: 4.2; 64: 6.0; 66: 6.2) IntraPeriod = 15 # Period of I-Frames (0=only first) VECPeriod = 0 # Period of VEC, distance between two sequence headers (0=doesn't exist at the bitstream) SeqHeaderPeriod = 0 # Period of Sequence Header, Number of IntraPeriod (0=only first) QPFirstFrame = 28 # Quant. param for first frame (intra) (0-63) QPRemainingFrame = 28 # Quant. param for remaining frames (0-63) QPBPicture = 28 # Quant. param for B frames (0-63) UseHadamard = 1 # Hadamard transform (0=not used, 1=used) SearchRange = 32 # Max search range NumberReferenceFrames = 2 # Number of previous frames used for inter motion search (1-5) InterSearch16x16 = 1 # Inter block search 16x16 (0=disable, 1=enable) InterSearch16x8 = 1 # Inter block search 16x8 (0=disable, 1=enable) InterSearch8x16 = 1 # Inter block search 8x16 (0=disable, 1=enable) InterSearch8x8 = 1 # Inter block search 8x8 (0=disable, 1=enable) ########################################################################################## # B Frames ########################################################################################## NumberBFrames = 0 # Number of B frames inserted (0=not used) FrameSkip = 2 # Number of frames to be skipped in input (e.g 2 will code every third frame) ########################################################################################## # RD Optimization ########################################################################################## RDOptimization = 1 # rd-optimized mode decision (0:off, 1:on) ########################################################################################## # Additional Stuff ######################################################################################### Progressive_frame = 1 # (0: Interlace, 1: Progressive) InterlaceCodingOption = 0 # (0: frame coding, 1: Field coding, 2: PAFF) repeat_first_field = 0 top_field_first = 1 ########################################################################################## # Loop filter parameters ########################################################################################## LoopFilterDisable = 0 # Disable loop filter in picture header (0=Filter, 1=No Filter) LoopFilterParameter = 0 # Send loop filter parameter (0= No parameter, 1= Send Parameter) LoopFilterAlphaOffset = 0 # Aplha offset in loop filter LoopFilterBetaOffset = 0 # Beta offset in loop filter ########################################################################################## # Slice parameters ########################################################################################## NumberOfRowsInSlice = 5 # number of MB rows in one Slice (0: one slice per frame) ########################################################################################## # Weighting Prediction parameters ########################################################################################## WeightEnable = 0 # Weighting Prediction ( 0 = disable , 1 = enable) ########################################################################################## #frame rate ########################################################################################### FrameRate = 5 # (1: 24000/1001,2: 24,3: 25,4: 30000/1001,5: 30,6: 50,7: 60000/1001,8: 60)###### ########################################################################################### #chroma format parameter ########################################################################################### ChromaFormat = 1 # (1=4:2:0,2=4:2:2) ######################################################################################## #Rate control ######################################################################################## RateControlEnable = 0 # 0 Disable, 1 Enable Bitrate = 6000000 # Bitrate(bps) InitialQP = 36 # Initial Quantization Parameter for the first I frame # InitialQp depends on two values: Bits Per Picture, # and the GOP length BasicUnit = 8160 # Number of MBs in the basic unit # should be a fractor of the total number # of MBs in a frame ChannelType = 0 # type of channel( 1=time varying channel; 0=Constant channel)
解码器配置文件decoder.cfg:
test.avs ........AVS coded bitstream test_dec.yuv ........Output file, YUV 4:2:0 format test_rec.yuv ........Ref sequence (for SNR) 2 ........Number of reference frame buffers, for memory managemnt only 0 ........Loopfilter disable(0: filter, 1: no loopfilter) This is a file containing input parameters to the Telenor H.26L decoder. The text line following each parameter is discarded by the decoder.========================================================================
好了,到这里已经讲清楚了AVS1编解码器的简单使用方法了。
至于在Linux/Unix下面的编译,也是很简单的,直接make就行了。
Makefiles are provided in the lencod and ldecod directory. 'make' comand will creat the obj directory and generate the executable file in the 'bin' directory.