Palachandra M V, Gajanan D Ma Ske (PathPartner Technology)
Today there is a growing need for Medical Video Compression in order to reduce file size on storage requirement. Higher compression ratio can be achieved using lossy compression technique, but this will lead to loss of information and may result in diagnostic errors. Hence there is a need to store medical video in lossless format. Traditional lossless compression technique results in low compression ratio, the goal is to maximize the compression using a lossless compression tool. HEVC encoding can effectively exploit the temporal and spatial redundancy observed in video sequence. This paper outlines lossless encoding mode of HEVC and how using lossless encoding mode, compression ratio of more than 2 (2:1) can be achieved.
This paper outlines an approach to improve the compression ratio of medical video sequence using HEVC (High Efficiency Video Coding) while satisfying the need of lossless encoding, as usage of lossy compression tools leads to loss of information of the original medical video sequence and may lead to diagnostic errors.
Smallest controllable element of a picture in a medical image is called a pixel. To obtain high image resolution, 16 bits are used to represent a pixel instead of 8 bits, this leads in increased size of medical image. Hence, there is a growing need for medical video compression that will facilitate efficient data transmission, real time tele-consultation and ease of storage. In medical video sequence high temporal and spatial redundancy can be observed. HEVC effectively exploits this temporal and spatial redundancy in order to achieve higher compression ratio. Using HEVC, medical video sequence can be encoded entirely lossless. In lossless encoding mode, normal predictions are still allowed, so the encoder will find optimal inter or intra prediction and encode the video sequence. In order to exploit the spatial redundancies HEVC uses Intra prediction and to exploit temporal dependency HEVC uses Inter prediction. In addition to Intra and Inter prediction an entropy coding technique CABAC is used for providing better compression. Using prediction and entropy coding tools and with transquant bypass mode enabled lossless compression, a compression ratio greater than 2 can be easily achieved. The paper elaborates on how to compress a medical video sequence entirely lossless using HEVC.
2. Medical Video compression
Consider a typical 16-bit medical X-ray image of UHD resolution that is 3840 pixels by 2160 pixels in resolution. This translates to a file size of approximately 16 MB (considering Luma component only). This results in increased disk storage and image transmission time. Even though disk storage has been increasing steadily, the volume of digital video images produced by hospitals has been increasing even faster. Even if there is infinite storage, there is still the problem of transmitting the medical video sequence over the network. Hence, there is a growing need for medical video compression to reduce file size on storage requirement. Medical video compression techniques take advantage of the redundancy that is observed in video sequence. There are different types of redundancy. Each compression methodology will exploit one of these redundancies. HEVC coding mainly exploits the spatial and temporal dependency observed in video sequence.
2.1 Medical Imaging compression research:
The data regarding error in medical imaging suggests that the incidence of imaging reports that provide wrong or misleading information is in the range of 2% to 4% . Hence the current focus of digital imaging is to reduce the diagnostic error, thereby medical community has been reluctant to adopt lossy techniques owing to the legal and regulatory issues that may be raised due to diagnostic errors. Lossless medical data compression is typically performed to reduce the redundancy within the image (Spatial redundancy). There are several common approaches that have been taken in the literature to perform this redundancy reduction step. The popular approaches of lossless encoding are DPCM, Huffman coding and Lempel–Ziv–Markov chain algorithm .
Differential Pulse Code Modulation (DPCM) is transformation for increasing the compressibility of an image. It involves scanning the image and predicting the next pixel value. There are several modes to predict the next pixels value. The average of the pixels to the left and the pixel above is used as the predicted value. The set of differences between each pixel and its predicted value is the residual image. The residual distribution is more compact than the original image. This results in lower entropy which determines the minimum code word length .
The Huffman coding technology is a commonly used scheme for data compression because it is very simple and effective. It requires the statistical distribution of the data to be coded. The details of the Huffman coding technique is described below.
- Histogram of the residual image.
- Build a coding tree by sorting the histogram and combining the two bins of lowest value until one bin remains.
- Encode the residual image and save the coding tree with coded values .
Lempel–Ziv–Markov chain algorithm:
The Lempel–Ziv–Markov chain algorithm (LZMA) is used to perform lossless data compression and was first used in the 7z format of the 7-Zip archive. This algorithm uses a dictionary compression scheme and features a high compression ratio while still maintaining decompression speed similar to other commonly used lossless compression algorithms.
DPCM encoding, Huffman encoding and Lempel–Ziv–Markov chain algorithm exploits the spatial dependency and not the temporal dependency, as all are intended for image compression but not for lossless video compression, HEVC is a video compression standard which exploits both spatial and temporal redundancies and performs entropy coding on the residual data to achieve higher compression ratio .
HEVC is prepared as the newest video coding standard of the ITU-T Video Coding Experts Group and the ISO/IEC Moving Picture Experts Group. Lossless compression is useful when it is necessary to minimize the storage space or transmission bandwidth of data while still maintaining archival quality. Many applications such as medical imaging, preservation of artwork, image archiving, remote sensing, and image analysis require the use of lossless compression, since these applications cannot allow any distortion in the reconstructed images. As the HEVC standard requires the video sequence in non-camera capture format i.e. in YUV format, thus to encode the image sequence for camera captured format, an internal conversion from RGB to YUV format is required.
RGB to YUV Conversion:
The traditional use of 8 bits for color representation provides us a 24-bit color space commonly known as True Color. Due to the limitation of rounding to the component bit depth, mapping between RGB and YUV color spaces are generally not reversible. For example, given all 24-bit RGB triplets, only 24% of them can be exactly recovered from converting to 8-bit YUV and back to 8-bit RGB using Rec.709. Because of clipping, most RGB triplets are off by ±1. However, increasing bit depth can improve the density of representation of colors and brightness throughout the entire range of colors. When converting between YUV greater than or equal to 10-bit and RGB 8- bit, the recovery rate is 100% because of the extra precision. Hence there are always measurable advantages of higher bit depth in video fidelity .
3.1. Overview of the HEVC lossless mode:
The basic approach for lossless video coding is bypassing transform and quantization steps in the encoder and the decoder. When the lossless mode is applied, all the in-loop filtering operations including deblocking filter and SAO are bypassed. Since there is no distortion existing in the reconstructed frame in the lossless mode, in-loop filtering operations will not help either picture quality or coding efficiency. The overall structure of the HEVC lossless mode is shown in below figure 1, dashed lines represent the bypass and all bypass operations are activated in the HEVC lossless mode .
Figure 1: Encoder structure of HEVC Lossless Mode.
3.2 Intra Prediction:
Intra prediction is used to exploit the spatial dependency in the image. HEVC specifies 33 angular predictions and two non-directional predictions (DC, Planar). The DC intra prediction mode generates a mean value by averaging reference samples and can be used for flat surfaces. The planar prediction mode in HEVC supports all block sizes defined in HEVC. The intra prediction modes use data from neighboring prediction blocks that have been previously decoded from within the same picture.
3.3 Inter Prediction:
Inter prediction is used to exploit the temporal dependency in the video sequence. Quarter sample precision is used for the motion vectors, and 7-tap or 8-tap filters are used for interpolation of fractional-sample positions. Multiple reference pictures are used. For each prediction block, either one or two motion vectors can be transmitted, resulting either in uni-predictive or bi-predictive coding. A scaling and offset operation may be applied to the prediction signal in a manner known as weighted prediction.
3.4 HEVC Format Range Extension (RExt):
The Format Range Extension (RExt) provides tools to support 4:0:0, 4:2:2 and 4:4:4 color spaces and additional bit depths. RExt encoding mode supports 16 bit depth pixel encoding. With HM version 16.0 the RExt branch was merged into the mainline HM software. This mode supports different flags such as extended precision with increased internal accuracies to support high bit depths which results in better compression of encoder stream. 
To validate the lossless compression methods and efficiency of HEVC encoding, we encoded two streams in RExt mode with transquant bypass mode enabled so the encoding is lossless. To achieve high compression ratio extended precision flag is enabled, LCU size is set to 64 and max coding unit depth is set to 4.
4.1 Example 1
The first is a medical video imaging sequence of pelvic area, the video images are captured using a high-resolution 16-bit scanner with resolution 1024x768 with 625 frames. We encoded the stream in RExt encoding mode with transquant bypass enabled (with P frame IPP..) so that the encoding is lossless and observed the compression ratio of 2.16. When we encoded the sequence with RA config, we observed the same compression ratio. To compare the encoding efficiency, we compressed the video sequence with 7z archive file format and observed the compression ratio of 1.8.
4.2 Example 2
The second is a medical video imaging sequence of Dental Head section, the video images are captured using a high-resolution 16-bit scanner with resolution 1152x1152 with 720 frames. We encoded the stream in RExt encoding mode with transquant bypass enabled (with P frame IPP..) so that the encoding is lossless, and observed the compression ratio of 2.35. When we encoded the same with RA config, we observed the same compression ratio. To compare encoding efficiency, we compressed the video sequence with 7z archive file format and observed the compression ratio of 1.98.
We decoded both the streams and bit-matched the HEVC decoded output with the input stream to be sure the encoding is lossless. Table 1 compares the compression ratio of HEVC encoding and 7z compression and Table 2 compares the encoding efficiency of HEVC encoding and 7z compression.
Compression Ratio = (UnCompressedFileSize / CompressedFileSize)
Encoding Efficiency = (1 – (CompressedFileSize / UnCompressedFileSize)) * 100
Table 1: Comparison of HEVC and 7z compression ratio for Medical Video Imaging streams.
Table 2: Comparison of HEVC encoding and 7z compression efficiency for Medical Video Imaging streams.
5. Conclusion and Future scope:
Based on the implementation results, this paper validates that using HEVC, Medical Video Imaging streams can be efficiently compressed and the compression is lossless. With RExt encoding mode, video imaging streams with 16 pixel bit-depth can be encoded and compression ratio greater than 2 can be achieved. Content Dependent Intra Mode Selection and customized motion estimation can be used to reduce the encoding time of video imaging sequence. The HEVC extension, on screen content coding can be used to achieve better compression ratio. Using on screen content coding compression ratio greater than 2.5 can be observed. 
1. Zukoski, M.J., Boult, T.and Iyriboz, T. (2006) ‘A novel approach to medical image compression’,Int. J. Bioinformatics Research and Applications, Vol. 2, No. 1, pp.89–103.
2. www.researchgate.net, Mr.Sampath Kumar., Mrs.Chandana.B.R, ‘Comparative Study of Lossless Compression Scheme Based on Huffman Coding for Medical Images’
3. www.nctatechnicalpapers.com, Indra Laksono, Cindy Guo, ‘HEVC and Higher Fidelity Video Why It’s Not Just Pixel Density Anymore’
4. Gary J. Sullivan, Jens-Rainer Ohm, Woo-Jin Han, and Thomas Wiegand, ‘IEEE-HEVC-Overview.pdf’ IEEE TRANSACTIONS ON CIRCUITS AND SYSTEMS FOR VIDEO TECHNOLOGY, VOL. 22, NO. 12, DECEMBER 2012
5. http://cdn.intechopen.com/pdfs-wm/41763.pdf, Harjot Pooni, Ashish Uthama and Victor Sanchez ‘Medical Image Compression’
6. Jung-Ah Choi and Yo-Sung Ho (2013). Differential Pixel Value Coding for HEVC Lossless Compression, Advanced Video Coding for Next-Generation Multimedia Services, Prof. Yo-Sung Ho (Ed.), ISBN: 978-953-51-0929-7, InTech, DOI: 10.5772/52878.
8. http://research.microsoft.com/pubs/238203/SCC_CfP.pdf, Bin Li and Jizheng Xu ‘An HEVC-based Screen Content Coding Scheme’
PathPartner based out of California, USA and Bangalore India is a leading provider of Consulting, Services and Solutions for digital media centric devices market. Our services range from Product Engineering/R&D and System Integration to Middleware, Applications and System solutions.
With an expert management team which has rich experience in Technology, Engineering & Business practices, PathPartner has Sales & marketing presence in USA, Europe, Korea and Taiwan. The company specializes in addressing challenges faced by leading OEMs, Silicon and OS providers in their product development.