
Rochester Institute of Technology RIT Scholar Works Theses 8-16-2002 A Parallel implementation of an mpeg-2 encoder using message- passing Jennifer Zenner Follow this and additional works at: https://scholarworks.rit.edu/theses Recommended Citation Zenner, Jennifer, "A Parallel implementation of an mpeg-2 encoder using message-passing" (2002). Thesis. Rochester Institute of Technology. Accessed from This Thesis is brought to you for free and open access by RIT Scholar Works. It has been accepted for inclusion in Theses by an authorized administrator of RIT Scholar Works. For more information, please contact [email protected]. A Parallel Implementation of an MPEG-2 Encoder Using Message-Passing by Jennifer L. Zenner A Thesis Submitted m Partial Fulfillment of the Requirements for the Degree of Master of Science m Computer Engineering Primary Advisor: _ Dr. Muhammad Shaaban, Assistant Professor Committee Member: _ Dr. Andreas Savakis, Associate Professor Committee Member: _ Dr. Kenneth Hsu, Professor Department of Computer Engineering Kate Gleason College of Engineering Rochester Institute of Technology Rochester, New York August 16, 2002 Release Permission Form Rochester Institute of Technology A Parallel Implementation of an MPEG-2 Encoder Using Message-Passing I, Jennifer L. Zenner, hereby grant permission to the Wallace Library of the Rochester Institute of Technology to reproduce this thesis, in whole or in part, for non-commercial and non-profit purposes only. Jennifer L. Zenner C3//{[)/{)L Date ABSTRACT The days of film are waning as digital cameras and digital video cameras are becom ing commonplace. Uncompressed digital video can consume large amounts of space, making it cumbersome to store efficiently. A method of video compression was de veloped by the Motion Pictures Expert Group (MPEG), and is now an international standard with the International Organization for Standardization (ISO). This thesis deals with the MPEG-2 Video standard, ISO/IEC 13818-2 [2]. The goal of this thesis is to explore the applications of MPEG-2 encoding in a parallel processing paradigm. To achieve this, a sequential MPEG-2 software encoder was obtained from the MPEG Software Simulation Group (MSSG) [18] and modified to be run, in parallel, on a cluster of single-processor Linux workstations using the Message Passing Interface (MPI) [11, 10, 3]. A multi-threaded pipeline of the encod ing process was created using Pthreads [6]. The resulting pipelined parallel encoder has been shown to produce compliant elementary MPEG-2 bitstreams for progres sive video sequences. Results of simulation showed that the parallel encoder always performed better than the sequential version as the number of processors scaled. However, it did not exhibit the ideal linear speedup that all parallel programs aim to achieve. This is due to the program executing on a set of resources not ideal for the multi-threaded pipeline. The ensuing chapters will provide the motivation for this work, and an overview of MPEG in addition to parallel processing and programming. Also forthcoming will be how it was achieved and the results produced. Supplementary applications of this work will also be discussed. TABLE OF CONTENTS List of Figures iii List of Tables v Acknowledgments vi Glossary vii Chapter 1: Introduction 1 Chapter 2: MPEG 4 2.1 Overview of MPEG 4 2.2 MPEG-2 5 2.2.1 Basics 5 2.2.2 Motion Estimation and Prediction 11 2.2.3 Discrete Cosine Transform (DCT) 14 2.2.4 Quantization and Variable-Length Coding 15 2.2.5 Plate Control 19 2.2.6 Compressed MPEG-2 Bitstream 22 Chapter 3: Parallel Processing and Programming 24 3.1 Parallel Processing 24 3.2 Parallel Architectures 27 3.2.1 Shared-Memory 28 3.2.2 Message-Passing 30 3.3 Parallel Programming 33 3.3.1 Parallel Language Constructs 34 3.3.2 Parallel Virtual Machine (PVM) 38 3.3.3 Message Passing Interface (MPI) 39 3.3.4 Pthreads 40 3.4 Parallel Approaches to MPEG 42 3.4.1 Message-Passing Approach 42 3.4.2 Shared-Memory Approach 47 Chapter 4: Pipelined Parallel MPEG-2 Encoder 50 4.1 Sequential Encoder 50 4.1.1 Input Parameters 50 4.1.2 Code Structure 54 4.2 Parallelization of Sequential Encoder 57 4.2.1 Message-Passing Parallelism using MPI 57 4.2.2 Multi-Threaded Pipeline using Pthreads 60 Chapter 5: Results 67 5.1 Setup 67 5.2 Experimental Results and Analysis 68 Chapter 6: Conclusions 75 6.1 Accomplishments 75 6.2 Limitations 75 6.3 Future Work 76 Appendix A: Appendices 77 Bibliography 78 n LIST OF FIGURES 2.1 MPEG-2 Encoder Flow Diagram 6 2.2 MPEG-2 Inter-frame Dependencies 7 2.3 MPEG-2 Video Layers 8 2.4 Motion Estimation Example 12 2.5 Frame vs. Field-Based Macroblocks [12] 14 2.6 MPEG-2 Quantization Scan Orders 17 2.7 Huffman Coding Example [20] 18 2.8 MPEG-2 Video Compressed Bitstream[24] 23 3.1 Steps of Parallelization [8] 25 3.2 Interconnection Schemes for Shared Memory Multiprocessors [8] .. 29 3.3 Mesh and Torus Network Topologies 31 3.4 Binary Tree Topology 32 3.5 Four-Dimensional Hypercube [4] 32 3.6 Butterfly Topology [8] 33 3.7 Deadlock 37 3.8 Frame-based Parallelization Methods [22] 43 4.1 GOP to Processor Assignment 59 4.2 MPEG-2 Pipeline Diagram 60 4.3 State Machine for Pipeline Scheduling 61 4.4 Data Flow through Pipeline 63 4.5 Diagram of Pipeline with Stalls 64 5.1 BBC3 Simulation Results 69 m 5.2 Table Tennis Simulation Results 70 5.3 Speedup vs. Number of Processors for Sequence Division Method [22] 73 iv LIST OF TABLES 2.1 Comparison of Encoding Order and Display Order 7 2.2 MPEG-2 Profiles and Levels [13] 10 2.3 Quantization Matrices 16 4.1 Frame Data Structures 56 4.2 Macroblock Information Structure 57 5.1 Execution Times 71 ACKNOWLEDGMENTS I would like to thank everyone who supported or helped me in any way to complete this thesis: Sharon Bacanskas (Mama) - For her unfailing support, encouragement, and unconditional love. Dr. Muhammad Shaaban - For being my advisor and for giving me insight and input. Dr. Andreas Savakis - For providing help and counsel when needed. Dr. Kenneth Hsu - For his encouragement and interest in this thesis. Dr. Roy Czernikowski - For suggestions and pointers. William Scheidel - For his suggestions, criticism and friendship. Doug Hoffman - For being a sounding board and providing suggestions and help with the cluster. Rick Tolleson, Paul Mezzanini - For technical support with the cluster and other related things. Paul Volcko - For providing me with the MPEG-2 Video Standard. VI GLOSSARY B FRAME: Bi-direcionally predicted frame. DATA DEPENDENCE: When one task needs data that another task produces. DCT: Discrete Cosine Transform. GOP: Group of Pictures in a video sequence. IDCT: Inverse Discrete Cosine Transform. I FRAME: Intra-coded frame. ISO: International Organization for Standardization. LOAD BALANCING: Assigning data to processes such that the amount of work performed by each process is equal. MAD: Mean Absolute Difference. MESSAGE-PASSING: The act of sending messages between tasks, processes or pro cessors for communication. MISD: Multiple Instruction-Single Data. MIMD: Multiple Instruction-Multiple Data. MPEG: Motion Pictures Expert Group. MPI: Message Passing Interface. vii MPMD: Multiple Program-Multiple Data. MSSG: MPEG Software Simulation Group. NETWORK TOPOLOGY: Configuration of the network connections between nodes. NODE: Processor in a cluster. P FRAME: Forward predicted frame. PROCESS: A mechanism that executes tasks. PTHREADS: Library to create threads in C programs. PVM: Parallel Virtual Machine. SHARED-MEMORY: Shared address space between processors. SISD: Single Instruction-Single Data. SIMD: Single Instruction-Multiple Data. SMP: Symmetric Multiprocessor. SPEEDUP: A factor indicating increase of speed in a parallel implementation over a sequential one. SPMD: Single Program-Multiple Data. TASK: Smallest amount of computation in a parallel program. vm Chapter 1 INTRODUCTION The days of film are waning as digital cameras and digital video cameras are becoming commonplace. Even cinemas are now turning to digital video technology. The larger the amount of digital video produced, the more there is a need for compression. Un compressed digital video can consume large amounts of space, making it cumbersome to store efficiently. The standard method of video compression was developed by the Motion Pictures Expert Group (MPEG), and is now a standard with the International Organization for Standardization (ISO). This thesis deals with the MPEG-2 Video standard, ISO/IEC 13818-2 [2]. MPEG-2 video compression exploits the temporal and spatial redundancy of frames in a video sequence. This is done temporally by reordering the frames at the input of the encoder to allow both forward and backward motion estimation and prediction. Spatially, the frames are transformed into the frequency domain by the Discrete Co higher- sine Transform (DCT), and frequency components are discarded or quantized. Because the human eye cannot perceive higher-frequency detail, the removal of that information does not effect the visual quality of the video. Furthermore, quantization and Huffman coding are also used to compress the DCT coefficients. Image processing techniques have long been considered ideal for parallelization due to the inherent parallelism in both low-level computations and high-level processing. There have been many successful attempts at parallelizing MPEG. Such attempts include dividing frames among processors in message-passing architectures and divid ing video sequences by groups of pictures (GOPs) [22, 21]. Other approaches consist of using shared-memory architectures to run multi-threaded parallel implementations [9]- This thesis explores the applications of MPEG-2 encoding in a parallel processing paradigm, with the goal of matching, or exceeding, performance of previous paral lel approaches.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages93 Page
-
File Size-