Files
doc_phd_thesis/021_VideoCoding/Figures/BlockPartitionsWithTree.tikz
T
2018-07-30 15:38:33 +01:00

125 lines
4.0 KiB
Plaintext

\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
decorations.pathreplacing,decorations.pathmorphing,shapes,%
matrix,shapes.symbols,plotmarks,decorations.markings,shadows,backgrounds}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfdeclarelayer{L0}
\pgfdeclarelayer{L1}
\pgfdeclarelayer{L2}
\pgfdeclarelayer{L3}
\pgfsetlayers{background,L0,L1,L2,L3,main,foreground}
\def\NodesSpacing{-1.6}
\newcommand{\scale}{.8}
\begin{tikzpicture}[scale=\scale,on grid, ->,>=stealth']
\tikzstyle{TextStyle}=[scale=.7,text centered]
\begin{scope}[scale=0.4]
\definecolor{LCUFill}{rgb}{0,0.5,1}
\definecolor{DrawColor}{rgb}{0,0,0.5}
\definecolor{LCUFill}{rgb}{1,1,1}
\definecolor{DrawColor}{rgb}{0,0,0}
\tikzstyle{CTU}=[draw=DrawColor, fill=LCUFill, very thick]
\tikzstyle{CU}=[draw=DrawColor, thin]
\tikzstyle{PU}=[draw=DrawColor, thin, densely dashed]
\node[TextStyle] at (8,16.5) {CTU - $64\times64$};
\draw[CTU] (0,0) rectangle ++(16,16); % 64x64
%% 32x32
\draw[CU] (0,0) rectangle ++(8,8); % 32x32
\draw[CU] (8,8) rectangle ++(8,8); % 32x32
%% Q1
\draw[CU] (0,8) rectangle ++(4,4); % 16x16
\draw[CU] (4,12) rectangle ++(4,4); % 16x16
\draw[CU] (4,12) rectangle ++(2,2); % 8x8
\draw[CU] (6,14) rectangle ++(2,2); % 8x8
%% Q3
\draw[CU] (0,0) rectangle ++(4,4); % 16x16
\draw[CU] (4,4) rectangle ++(4,4); % 16x16
\draw[CU] (4,4) rectangle ++(2,2); % 8x8
\draw[CU] (6,6) rectangle ++(2,2); % 8x8
\draw[PU] (4,4) rectangle ++(1,1); % 4x4
\draw[PU] (5,5) rectangle ++(1,1); % 4x4
\node[TextStyle] at (12,12) {$32\times32$};
\node[TextStyle] at (2,14) {$16\times16$};
\node[TextStyle,scale=.9] at (5,13) {$8\times8$};
\node[TextStyle] (CULabel) at (9.5,6) {CU};
\draw[black, -latex] (CULabel) to (7,7);
\node[TextStyle] (PULabel) at (2.5,5.5) {PU};
\draw[black, -latex] (PULabel) to (4.5,4.5);
\end{scope}
% %H.264
% \node[TextStyle] (PULabel) at (10.5,4.5) {\textcolor{red}{MB}};
% \draw[black, -latex] (PULabel) to (13,3);
% \draw[CU, draw=red] (12,0) rectangle ++(4,4); % 16x16
% \draw[CU, draw=red] (14,0) rectangle ++(2,2); % 8x8
% \draw[CU, draw=red] (12,2) rectangle ++(2,2); % 8x8
% \draw[CU, draw=red] (15,0) rectangle ++(1,1); % 4x4
% \draw[CU, draw=red] (14,1) rectangle ++(1,1); % 4x4
\tikzset{
level 1/.style={level distance = 1.6cm, sibling distance=1.6cm},
level 2/.style={level distance = 1.6cm, sibling distance=.7cm},
level 3/.style={level distance = 1.6cm, sibling distance=.65cm},
treenode/.style = {align=center, inner sep=0pt, text centered, font=\sffamily},
node_split/.style = {treenode, circle,inner sep=1pt, white, font=\sffamily\bfseries, draw=black, fill=black},
node_cu/.style = {treenode, circle, draw, thick, font=\sffamily\bfseries\scriptsize, text width=.95em}
}
\begin{scope}[xshift=12cm,yshift=15*.4cm]
\node [node_split,scale=1/\scale] (CUD0) at (0,0) {}
child{ node [node_split] {}
child{ node [node_cu] {1} }
child{ node [node_split] {}
child{ node [node_cu] {2} }
child{ node [node_cu] {3} }
child{ node [node_cu] {4} }
child{ node [node_cu] {5} }
}
child{ node [node_cu] {5} }
child{ node [node_cu] {6} }
}
child{ node [node_cu] {7} }
child{ node [node_split] {}
child{ node [node_cu] {8} }
child{ node [node_split] {}
child{ node [node_cu] {9} }
child{ node [node_cu] {10} }
child{ node [node_cu] {11} }
child{ node [node_cu] (CUD3) {12} }
}
child{ node [node_cu] {13} }
child{ node [node_cu] (CUD2) {14} }
}
child{ node [node_cu] (CUD1) {15} }
;
\node[TextStyle, right=3.5 of CUD0] (D0) {Depth 0};
\node[TextStyle] (D1) at (D0 |- CUD1) {Depth 1};
\node[TextStyle] (D2) at (D0 |- CUD2) {Depth 2};
\node[TextStyle] (D3) at (D0 |- CUD3) {Depth 3};
\foreach \name / \y in {0,...,3}
\node[coordinate, left=1 of D\name] (P-\name) {};
\foreach \name / \y in {0,...,3}
\path[draw, -] (D\name) -- (P-\name);
\end{scope}
\end{tikzpicture}