JM8.5中的7种宏块模式问题 - zhoujunming的专栏 - CSDN博客

来源:百度文库 编辑:神马文学网 时间:2024/04/30 04:40:24

JM8.5中的7种宏块模式问题 收藏
Outline:

1、  CFG文件中有关可变尺寸宏块模式的相关选项
2、  7种宏块模式对应的数值常量3、  7种宏块模式被分成宏块和亚宏块4、  如何对宏块和亚宏块的运动估计,采用一个共同的函数来处理5、  遗留问题 

 1、CFG文件中有关可变尺寸宏块模式的相关选项

###############################################################################
#Encoder Control###############################################################################…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)InterSearch8x4        =  1  # Inter block search  8x4  (0=disable, 1=enable)InterSearch4x8        =  1  # Inter block search  4x8  (0=disable, 1=enable)InterSearch4x4        =  1  # Inter block search  4x4  (0=disable, 1=enable)

解释:

各种宏块尺寸可以在程序外部进行选择。

2、  7种宏块模式对应的数值常量

各种宏块模式对应的数值常量如下:
16×16-1     16×8-2       8×16-3       8×8-4    8×4-5     4×8-6      4×4-7 

以上的数值常量的rdopt.c的encode_one_macroblock()中的valid[]数组和mode变量中会用到,另外在mv_search.c的PartitionMotionSearch()中的blocktype变量也会用到。

 

3、   7种宏块模式被分成宏块和亚宏块

16x16, 16x8, 8x16(,8×8)被称为宏块级,而8×8,8×4,4×8,4×4被称为亚宏块级。
所用到的函数是:encode_one_macroblock(),rdopt.c该函数的作用是编码一个宏块(包括帧间、帧内、帧内预测的方式)。其中重要的程序段如下: //宏块级运动估计
//===== MOTION ESTIMATION FOR 16x16, 16x8, 8x16 BLOCKS =====for (min_cost=1<<20, best_mode=1, mode=1; mode<4; mode++){    if (valid[mode])//对应于程序外部(即CFG文件中)的设置    {        //对于16×16,MB只分一个块;对于16×8和8×16,MB被分成两个块        for (cost=0, block=0; block<(mode==1?1:2); block++)        {            //块匹配!!!lambda_motion用来求运动矢量消耗的码率           PartitionMotionSearch (mode, block, lambda_motion);            …//亚宏块级运动估计
if (valid[P8x8]){  …//=====  LOOP OVER POSSIBLE CODING MODES FOR 8x8 SUB-PARTITION  =====for (min_cost8x8=(1<<20), min_rdcost=1e30, index=(bframe?0:1); index<5; index++){    if (valid[mode=b8_mode_table[index]])//b8_mode_table[6] = {0, 4, 5, 6, 7};    {       curr_cbp_blk = 0;        if (mode==0) //--- Direct Mode ---        {            …        } // if (mode==0)        else        {            //--- motion estimation for all reference frames ---            PartitionMotionSearch (mode, block, lambda_motion);         …NOTE:从上面程序段中可以看出JM8.5中对7种宏块模式是采用全部遍历的方式,所以导致的计算复杂度很高。 4、  如何对宏块和亚宏块的运动估计,采用一个共同的函数来处理
从3中的程序可以看到,对于宏块和亚宏块级的运动估计,都采用了一个共同的函数:PartitionMotionSearch(), mv_search.c其中重要的程序段如下:
……//各种宏块模式下的子块的起始偏移量,相对4*4块来讲,这有利于运动矢量的存放
//[5]表示宏块的类型,[4]表示各种类型下的子块序号,最多子块情况为P8X8模式下有4个static int  bx0[5][4] = {{0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,2,0,0}, {0,2,0,2}};
static int  by0[5][4] = {{0,0,0,0}, {0,0,0,0}, {0,2,0,0}, {0,0,0,0}, {0,0,2,2}};
……int   parttype  = (blocktype<4?blocktype:4);//亚宏块的parttype都设为4 //step_?是用来求4*4块级别的步长,

//由于parttype和blocktype的区别使得两组步长之间存在微妙的差异,为下面的循环做好了铺垫

int   step_h0   = (input->blc_size[ parttype][0]>>2);
int   step_v0   = (input->blc_size[ parttype][1]>>2);int   step_h    = (input->blc_size[blocktype][0]>>2);int   step_v    = (input->blc_size[blocktype][1]>>2);… //===== LOOP OVER SUB MACRO BLOCK partitions//这里对于亚宏块的循环是自适应的,//假如小于8*8块尺寸时,自动采取循环for (v=by0[parttype][block8x8]; vblock_y + v;    for (h=bx0[parttype][block8x8]; h……
JM8.5中的7种宏块模式问题 - zhoujunming的专栏 - CSDN博客 JM8.5中的7种宏块模式问题 - 李世平的专栏 - CSDNBlog JM8.5中的7种宏块模式问题 软件设计模式(耦合) - LZD_jay的专栏 - CSDN博客 mtk 黑屏重启问题 - feelinghappy的专栏 - CSDN博客 MFC中的消息映射宏 - magicyang87的专栏 - CSDN博客 windows中的CreatThread - cnctloveyu的专栏 - CSDN博客 baozhengw的专栏 - CSDN博客 tomcat5.5 整合 iis6.0 - shangpusp的专栏 - CSDN博客 用Delphi实现四人帮(Gof)设计模式-3装饰模式 Decorator MOdel - cococlout的专栏 - CSDN博客 用Delphi实现四人帮(Gof)设计模式-8构建者模式 Builder - cococlout的专栏 - CSDN博客 用Delphi实现四人帮(Gof)设计模式-9观察者模式Publish/Subscribe,Observer - cococlout的专栏 - CSDN博客 Keil C51汉字显示的bug问题 - willhu2008的专栏 - CSDN博客 Linux下共享库路径配置问题[ZZ|FY] - ldong2007的专栏 - CSDN博客 网上邻居不能访问问题精解 - loverong的专栏 - CSDN博客 如何检测和避免代码中的存储转发冲突 - Duofeng的专栏 - CSDN博客 Windows XP中的新型向量化异常处理 - 冒险岛的专栏 - CSDN博客 C++中的位拷贝和值拷贝 - liam1122(小亮)的专栏 - CSDN博客 漫谈.NET开发中的字符串编码 - bitfan(数字世界一凡人)的专栏 - CSDN博客 AGPS简介 - kv110的专栏 - CSDN博客 OpenMAX简介 - shenbin1430的专栏 - CSDN博客 Android flinger - simmer_ken的专栏 - CSDN博客 windows 命令 - orangeman1982112的专栏 - CSDN博客 JNDI概述 - tanghongru1983的专栏 - CSDN博客