2021年5月18日 / 79次阅读 / Last Modified 2021年5月25日
图像处理
记录一下HEVC中的Z-Scan概念,如下图:
上图两个g开头的全局变量,来时HM软件。
在HEVC的标准文档中,6.5.2部分,有一个初始化Z-Scan数组的算法,数组的名称为 MinTbAddrZs:
953 # 6.5.2
954 # MinTbAddrZs[x][y]
955 diff = csps['CtbLog2SizeY'] - csps['MinTbLog2SizeY']
956 num_x = csps['PicWidthInCtbsY'] << diff
957 num_y = csps['PicHeightInCtbsY'] << diff
958 MinTbAddrZs = [[-1 for j in range(num_y)] for i in range(num_x)]
959 for y in range(num_y):
960 for x in range(num_x):
961 tbX = (x<<csps['mintblog2sizey'])>> csps['CtbLog2SizeY']
962 tbY = (y<<csps['mintblog2sizey'])>> csps['CtbLog2SizeY']
963 ctbAddrRs = csps['PicWidthInCtbsY'] * tbY + tbX
964 MinTbAddrZs[x][y] = cpps['CtbAddrRsToTs'][ctbAddrRs] << (diff*2)
965 p = 0
966 for i in range(diff):
967 m = 1 << i
968 p += (m*m if m&x else 0) + (2*m*m if m&y else 0)
969 MinTbAddrZs[x][y] += p
970 cpps['MinTbAddrZs'] = MinTbAddrZs
下面这段文字,说明了z-scan的重要作用:
The CUs inside a CTU are coded in a depth-first order. This coding order is also referred to as z-scan and ... It ensures that for each CU, except those located at the top or left boundary of a slice, all samples above the CU and left to the CU have already been coded, so that the corresponding samples can be used for intra prediction and the associated coding parameters can be used for predicting the coding parameters of the current CU.
遍历CTU中的每一个CU的过程,就是z-scan!
-- EOF --
本文链接:https://www.pynote.net/archives/3680
《HEVC中的Z-Scan》有1条留言
©Copyright 麦新杰 Since 2019 Python笔记
HM代码中常常见到uiAbsPartIdx这个变量,它就是zorder下,将CTU划分成4x4的最小块后,每一块的编号。这个编号,本质上,确定的是一个坐标。 [ ]