hm编码工具使用_HM中字典编码分析

LZ77算法基本过程http://jpkc.zust.edu.cn/2007/dmt/course/MMT03_05_2.htm输入待字典编码的CU,CopyCuFromPicYuv444(pcPic,m_pCuBuf, cuIdx,bEncOrg);待编码的输入64*64,重排序后的YUV (*(m_matchFinderBase.stream)).datavoid CDictEncoder::...
摘要由CSDN通过智能技术生成

LZ77算法基本过程http://jpkc.zust.edu.cn/2007/dmt/course/MMT03_05_2.htm

输入待字典编码的CU,

CopyCuFromPicYuv444(pcPic,m_pCuBuf, cuIdx,bEncOrg);

待编码的输入64*64,重排序后的YUV (*(m_matchFinderBase.stream)).data

void CDictEncoder::WriteStrMapResult(int len, int pos,const UChar * pCurBuf)

//写入编码的结果,32位数的iDst编码结果push_banck到m_pStrMapBufList,m_uCurrPackSize为list大小。

{

if (len == 1 && pos == (UInt)-1)//没有匹配的

{

if (numCoded>=3)

{

litFlag = (pCurBuf[0]-pCurBuf[-3])<0;

c = (UInt)ABS_DIFF(pCurBuf[0],pCurBuf[-3]);

}

else

c = (UInt)pCurBuf[0];

WriteBits(iDst,0,1,1);

WriteBits(iDst,litFlag,1,2);//因为排列顺序是YUVYUV,所以编的是与pCurBuf[-3]的差值,litFlag表示差值的正负

WriteBits(iDst,c,8,3);

}

else

{

WriteBits(iDst,1,1,1); //第1个bit占一位,指示有匹配,第2bit开始的9位表示匹配长度len,第11bit开始的22位表示偏移pos

WriteBits(iDst,len,9,2);

WriteBits(iDst,pos,22,11);

}

}

void CDictEncoder::DictCodeOneBlock()

{

for (;;)

{

len = GetOptimumFast(&pos);//返回最佳的匹配,len长度,pos偏移

pCurBuf = MatchFinder_GetPointerToCurrentPos(&m_matchFinderBase) - m_uAdditionalOffset;

//(m_matchFinderBase).buffer匹配的结束位置,即m_uAdditionalOffset=len,向前len为匹配的开始位置pCurBuf,len>8 时匹配串在pCurBuf-(pos-8)-1, pos<8时,在pC

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值