# Coding tree unit

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Coding_tree_unit
> Markdown URL: https://mediated.wiki/source/Coding_tree_unit.md
> Source: https://en.wikipedia.org/wiki/Coding_tree_unit
> Source revision: 1335545372
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

'''Coding tree unit''' ('''CTU''') is the basic processing unit of the [High Efficiency Video Coding](/source/High_Efficiency_Video_Coding) (HEVC) video standard and conceptually corresponds in structure to [macroblock](/source/macroblock) units that were used in several previous video standards.<ref name=OverviewHEVCIEEE2013>{{cite news |title=Overview of the High Efficiency Video Coding (HEVC) Standard |author=G.J. Sullivan |author2=J.-R. Ohm |author3=W.-J. Han |author4=T. Wiegand |author4-link=Thomas Wiegand |publisher=IEEE Transactions on Circuits and Systems for Video Technology |url=http://iphome.hhi.de/wiegand/assets/pdfs/2012_12_IEEE-HEVC-Overview.pdf |date=2012-05-25 |accessdate=2013-04-26|archive-url=https://web.archive.org/web/20130305231013/http://iphome.hhi.de/wiegand/assets/pdfs/2012_12_IEEE-HEVC-Overview.pdf | archive-date=March 5, 2013}}</ref><ref name=CodingEfficiencyHEVCIEEE2012>{{cite news |title=Comparison of the Coding Efficiency of Video Coding Standards&nbsp;– Including High Efficiency Video Coding (HEVC) |author=G.J. Sullivan |author2=Heiko Schwarz |author3=Thiow Keng Tan |author4=Thomas Wiegand |author4-link=Thomas Wiegand |publisher=IEEE Transactions on Circuits and Systems for Video Technology |url=http://iphome.hhi.de/wiegand/assets/pdfs/2012_12_IEEE-HEVC-Performance.pdf |date=2012-08-22 |accessdate=2013-04-26}}</ref> CTU is also referred to as '''largest coding unit''' ('''LCU''').<ref name=HEVCJuly2012MeetingNotes>{{cite news |title=Meeting report of the 10th meeting of the Joint Collaborative Team on Video Coding (JCT-VC), Stockholm, SE, 11-20 July 2012 |author=Gary Sullivan |author2=Jens-Rainer Ohm |publisher=JCT-VC |url=http://phenix.it-sudparis.eu/jct/doc_end_user/current_document.php?id=6466 |date=2012-10-13 |accessdate=2013-04-28}}</ref>

A CTU can be between 16×16 pixels and 64×64 pixels in size with a larger size usually increasing coding efficiency.<ref name=OverviewHEVCIEEE2012>{{cite news |title=Overview of the High Efficiency Video Coding (HEVC) Standard |author=G.J. Sullivan |author2=J.-R. Ohm |author3=W.-J. Han |author4=T. Wiegand |publisher=IEEE Transactions on Circuits and Systems for Video Technology |url=http://iphome.hhi.de/wiegand/assets/pdfs/2012_12_IEEE-HEVC-Overview.pdf |date=2012-05-25 |accessdate=2013-04-26}}</ref><ref name=CodingEfficiencyHEVCIEEE2012/> The first video standard that uses CTUs is HEVC/H.265 which became an [ITU-T](/source/ITU-T) standard on April 13, 2013.<ref name=HEVCAprilApproved2013ITURecommendations>{{cite news |title=ITU-T Home : Study groups : ITU-T Recommendations : ITU-T H.265 (04/2013) |publisher=ITU |url=http://www.itu.int/ITU-T/recommendations/rec.aspx?rec=11885 |date=2013-04-13 |accessdate=2013-04-16}}</ref><ref name=HEVCAprilApproved2013ITUAAPDetails>{{cite news |title=AAP Recommendation: H.265 |publisher=ITU |url=http://www.itu.int/ITU-T/aap/AAPRecDetails.aspx?AAPSeqNo=2741 |date=2013-04-13 |accessdate=2013-04-16}}</ref><ref name=HEVCAprilApproved2013ITUAAPAnnouncement>{{cite news |title=AAP Announcement No. 09 |publisher=ITU |url=http://www.itu.int/dms_pubaap/01/T0101000F09.htm |date=2013-04-15 |accessdate=2013-04-16}}</ref>

==History==
Macroblock encoding methods have been used in digital video coding standards since [H.261](/source/H.261) which was first released in 1988. However, for [error correction](/source/error_correction) and [signal-to-noise ratio](/source/signal-to-noise_ratio) the standard 16x16 macroblock size is not capable of getting the kind of bit reductions that [information theory](/source/information_theory) and [coding theory](/source/coding_theory) suggest are theoretically and practically possible.<ref>{{cite web |url=http://x264dev.multimedia.cx/archives/317 |title=Diary of an x264 Developer » the problems with wavelets |accessdate=2014-02-06 |url-status=dead |archiveurl=https://web.archive.org/web/20140129171425/http://x264dev.multimedia.cx/archives/317 |archivedate=2014-01-29 }}</ref>

==Technical details==
HEVC replaces [macroblock](/source/macroblock)s, which were used with previous video standards, with CTUs which can use larger block structures of up to 64×64 pixels and can better sub-partition the picture into variable sized structures.<ref name=OverviewHEVCIEEE2012/><ref name=MPEGPressRelease>{{cite news |title=Description of High Efficiency Video Coding (HEVC) |publisher=JCT-VC |url=http://mpeg.chiariglione.org/technologies/mpeg-h/HEVC.htm |date=2011-01-01 |accessdate=2012-09-15}}</ref>

HEVC initially divides the picture into CTUs which are then divided for each luma/chroma component into coding tree blocks (CTBs).<ref name=OverviewHEVCIEEE2012/><ref name=MPEGPressRelease/>

A CTB can be 64×64, 32×32, or 16×16 with a larger pixel block size usually increasing the coding efficiency.<ref name=OverviewHEVCIEEE2012/> CTBs are then divided into one or more coding units (CUs), so that the CTU size is also the largest coding unit size.<ref name=OverviewHEVCIEEE2012/>

* The arrangement of CUs in a CTB is known as a [quadtree](/source/quadtree) since a subdivision results in four smaller regions.<ref name=OverviewHEVCIEEE2012/>
* CUs are then divided into prediction units (PUs) of either intra-picture or inter-picture prediction type which can vary in size from 64×64 to 4×4.<ref name=OverviewHEVCIEEE2012/><ref name=MPEGPressRelease/> To limit worst-case memory bandwidth when applying motion compensation in the decoding process, prediction units coded using inter-picture prediction are restricted to a minimum size of 8×4 or 4×8 if they are predicted from a single reference (uni-prediction) or 8×8 if they are predicted from two references (bi-prediction).<ref name=OverviewHEVCIEEE2012/><ref name=HEVCdraft10/>
* To code the prediction residual, a CU is divided into a quadtree of [DCT](/source/Discrete_cosine_transform) transform units (TUs).<ref name=OverviewHEVCIEEE2012/><ref name="apple">{{cite web |last1=Thomson |first1=Gavin |last2=Shah |first2=Athar |title=Introducing HEIF and HEVC |url=https://devstreaming-cdn.apple.com/videos/wwdc/2017/503i6plfvfi7o3222/503/503_introducing_heif_and_hevc.pdf |publisher=[Apple Inc.](/source/Apple_Inc.) |year=2017 |accessdate=5 August 2019}}</ref> TUs contain coefficients for spatial block transform and quantization.<ref name=OverviewHEVCIEEE2012/><ref name=MPEGPressRelease/> A TU can be 32×32, 16×16, 8×8, or 4×4 pixel block sizes.<ref name=OverviewHEVCIEEE2012/>

==Standardization==
At the July 2012 HEVC meeting it was decided, based on proposal JCTVC-J0334, that HEVC level 5 and higher would be required to use CTB sizes of either 32×32 or 64×64.<ref name=HEVCJuly2012MeetingNotes/><ref name=HEVCJuly2012J0334>{{cite news |title=Adding a Level Restriction on Coding Tree Block Size |author=Wade Wan |author2=Tim Hellman |publisher=JCT-VC |url=http://phenix.it-sudparis.eu/jct/doc_end_user/current_document.php?id=6197 |date=2012-07-03 |accessdate=2012-09-22}}</ref> This was added to HEVC in the Draft International Standard as a level limit for the Log2MaxCtbSize variable.<ref name=HEVCdraft8>{{cite news |title=High Efficiency Video Coding (HEVC) text specification draft 8 |publisher=JCT-VC |url=http://phenix.it-sudparis.eu/jct/doc_end_user/current_document.php?id=6465 |date=2012-07-28 |accessdate=2012-07-31}}</ref>

Log2MaxCtbSize was renamed CtbSizeY in the October 2012 HEVC draft and then renamed CtbLog2SizeY in the January 2013 HEVC draft.<ref name=HEVCdraft10>{{cite news |title=High Efficiency Video Coding (HEVC) text specification draft 10 (for FDIS & Consent) |publisher=JCT-VC |url=http://phenix.it-sudparis.eu/jct/doc_end_user/current_document.php?id=7243 |date=2013-01-17 |accessdate=2013-01-24}}</ref><ref name=HEVCdraft9>{{cite news |title=High Efficiency Video Coding (HEVC) text specification draft 9 |publisher=JCT-VC |url=http://phenix.it-sudparis.eu/jct/doc_end_user/current_document.php?id=6803 |date=2012-10-22 |accessdate=2012-10-23}}</ref>

==Coding efficiency==
The design of most video coding standards is primarily aimed at having the highest coding efficiency.<ref name=CodingEfficiencyHEVCIEEE2012/> Coding efficiency is the ability to encode video at the lowest possible bit rate while maintaining a certain level of video quality.<ref name=CodingEfficiencyHEVCIEEE2012/> HEVC benefits from the use of larger CTB sizes.<ref name=CodingEfficiencyHEVCIEEE2012/>

This has been shown in [peak signal-to-noise ratio](/source/peak_signal-to-noise_ratio) (PSNR) tests with a HM-8.0 HEVC encoder where it was forced to use progressively smaller CTU sizes.<ref name=CodingEfficiencyHEVCIEEE2012/> For all test sequences when compared to a 64×64 CTU size it was shown that the HEVC bit rate increased by 2.2% when forced to use a 32×32 CTU size and increased by 11.0% when forced to use a 16×16 CTU size.<ref name=CodingEfficiencyHEVCIEEE2012/>

In the Class A test sequences, where the resolution of the video was 2560×1600, when compared to a 64×64 CTU size it was shown that the HEVC bit rate increased by 5.7% when forced to use a 32×32 CTU size and increased by 28.2% when forced to use a 16×16 CTU size.<ref name=CodingEfficiencyHEVCIEEE2012/>

The tests showed that large CTU sizes become even more important for coding efficiency with higher resolution video.<ref name=CodingEfficiencyHEVCIEEE2012/> The tests also showed that it took 60% longer to decode HEVC video encoded at 16×16 CTU size than at 64×64 CTU size.<ref name=CodingEfficiencyHEVCIEEE2012/> The tests showed that large CTU sizes increase coding efficiency while also reducing decoding time.<ref name=CodingEfficiencyHEVCIEEE2012/> The tests were conducted with the Main profile of HEVC based on equal PSNR.<ref name=CodingEfficiencyHEVCIEEE2012/>

{| class="wikitable" style="text-align:right; "
|+ Increase in video bit rate when smaller CTU sizes were used<ref name=CodingEfficiencyHEVCIEEE2012/>
|-
!rowspan="2"| Video test sequences
!colspan="3"| Maximum CTU size used in video encoding<br/>in comparison to 64×64 CTUs
|-
! 64×64 CTUs
! 32×32 CTUs
! 16×16 CTUs
|-
! Class A (2560×1600 pixels)
| 0%
| 5.7%
| 28.2%
|-
! Class B (1920×1080 pixels)
| 0%
| 3.7%
| 18.4%
|-
! Class C (832×480 pixels)
| 0%
| 1.8%
| 8.5%
|-
! Class D (416×240 pixels)
| 0%
| 0.8%
| 4.2%
|-
! Overall
| 0%
| 2.2%
| 11.0%
|-
! Encoding time
| 100%
| 82%
| 58%
|-
! Decoding time
| 100%
| 111%
| 160%
|}

==See also==
*[High Efficiency Video Coding](/source/High_Efficiency_Video_Coding) (HEVC) - Video standard that supports 8K UHDTV and resolutions up to 8192 × 4320
*[H.264/MPEG-4 AVC](/source/H.264%2FMPEG-4_AVC) - The predecessor video standard of HEVC
*[VP9](/source/VP9) - A video codec with superblocks, which are similar to CTUs
*[Macroblock](/source/Macroblock) - The basic processing unit used in several previous video standards

==References==
{{Reflist|2}}

==External links==
*[http://iphome.hhi.de/wiegand/assets/pdfs/2012_12_IEEE-HEVC-Overview.pdf HEVC overview]
*[http://iphome.hhi.de/wiegand/assets/pdfs/2012_12_IEEE-HEVC-Performance.pdf HEVC coding efficiency]
*[http://www.itu.int/rec/T-REC-H.265 ITU-T Recommendation H.265 - High Efficiency Video Coding]

{{Compression methods}}

Category:IEC standards
Category:ISO standards
Category:ITU-T recommendations
Category:Lossy compression algorithms
Category:MPEG
Category:Video compression
Category:Data compression

---
Adapted from the Wikipedia article [Coding tree unit](https://en.wikipedia.org/wiki/Coding_tree_unit) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Coding_tree_unit?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
