H.264 and mPeg-4 video Compression Video Coding for Next-generation Multimedia ain e. g. richardson The robert Gordon University, Aberdeen, UK WIlEY
H.264 and MPEG-4 Video Compression Video Coding for Next-generation Multimedia Iain E. G. Richardson The Robert Gordon University, Aberdeen, UK
Copyright o 2003 John Wiley Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex Po19 8SQ, England 1243779777 Email (for orders and customer service enquiries): cs-books@ wiley. co uk sitourHomePageonwww.wileyeurope.comorwww.wiley.com any form or by any means, electronic, mechanical, ph scanning or otherwise, except under the terms of the Copyright, Designs and Patents Act 1988 or under the terms of a licence issued by the Copyright Licensing Agency Ltd, 90 Totte Court Road, London WIT 4LP, UK, without the permission in writing of the Publisher Requests to the Publisher should be addressed to the Permissi partment, John Wi Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex PO19 &SQ, England or to permreq@ wiley. co uk, or faxed to(+44)1243 770620. This publication is designed to provide accurate and authoritative information in regard to the subject matter covered. It is sold on the understanding that the Publisher is not engaged in rendering professional services. If professional advice or other expert assistance is required, the services of a competent professional should be sought. John Wiley Sons Inc, 111 River Street, Hoboken, NJ 07030, USA Jossey-Bass, 989 Market Street, San Francisco, CA 94103-1741, USA Wiley-VCH Verlag GmbH, Boschstr. 12, D-69469 Weinheim, Germany John Wiley Sons Australia Ltd, 33 Park Road, Milton, Queensland 4064, Australia John Wiley Sons(Asia)Pte Ltd, 2 Clementi Loop #02-01, Jin Xing Distripark, Singapore 129809 John Wiley Sons Canada Ltd, 22 Worcester Road, Etobicoke, Ontario, Canada M9WILI Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic bo British Library Cataloguing in Publication Data A catalogue record for this book is available from the British Libi ISBN0470-848375 Typeset in 10/12pt Times roman by New Delhi India Great Britain by Antony Rowe, Chippenham, Wiltshire This book is printed on acid-free paper responsibly manufactured from sustainable forestry in which at least two trees are planted for each one used for paper production
Copyright C 2003 John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex PO19 8SQ, England Telephone (+44) 1243 779777 Email (for orders and customer service enquiries): cs-books@wiley.co.uk Visit our Home Page on www.wileyeurope.com or www.wiley.com All Rights Reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except under the terms of the Copyright, Designs and Patents Act 1988 or under the terms of a licence issued by the Copyright Licensing Agency Ltd, 90 Tottenham Court Road, London W1T 4LP, UK, without the permission in writing of the Publisher. Requests to the Publisher should be addressed to the Permissions Department, John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex PO19 8SQ, England, or emailed to permreq@wiley.co.uk, or faxed to (+44) 1243 770620. This publication is designed to provide accurate and authoritative information in regard to the subject matter covered. It is sold on the understanding that the Publisher is not engaged in rendering professional services. If professional advice or other expert assistance is required, the services of a competent professional should be sought. Other Wiley Editorial Offices John Wiley & Sons Inc., 111 River Street, Hoboken, NJ 07030, USA Jossey-Bass, 989 Market Street, San Francisco, CA 94103-1741, USA Wiley-VCH Verlag GmbH, Boschstr. 12, D-69469 Weinheim, Germany John Wiley & Sons Australia Ltd, 33 Park Road, Milton, Queensland 4064, Australia John Wiley & Sons (Asia) Pte Ltd, 2 Clementi Loop #02-01, Jin Xing Distripark, Singapore 129809 John Wiley & Sons Canada Ltd, 22 Worcester Road, Etobicoke, Ontario, Canada M9W 1L1 Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. British Library Cataloguing in Publication Data A catalogue record for this book is available from the British Library ISBN 0-470-84837-5 Typeset in 10/12pt Times roman by TechBooks, New Delhi, India Printed and bound in Great Britain by Antony Rowe, Chippenham, Wiltshire This book is printed on acid-free paper responsibly manufactured from sustainable forestry in which at least two trees are planted for each one used for paper production
Contents about the author Foreword Preface IX 1 Introduction 1.1 The Scene 1.2 Video Compression 1.3 MPEG-4 and H. 264 5 1. 4 This book 1.5 References 7 2 Video Formats and quality 9 2.1 Introduction 2.2 Natural Video scenes 2.3 Capture 10 2.3. 1 Spatial Sampling 11 2.3.2 Temporal Sampling 2.3.3 Frames and Fields 2.4 Colour Spaces 2.4.1RGB 2.4.2 YCbCr 15 2.4.3 YCbCr Sampling Formats 17 2.5 Video formats 2.6 Quality 20 2.6.1 Subjective Quality Measurement 2.6.2 Objective Quality Measurement 2.7 Conclusions 24 2.8 References
Contents About the Author xiii Foreword xv Preface xix Glossary xxi 1 Introduction 1 1.1 The Scene 1 1.2 Video Compression 3 1.3 MPEG-4 and H.264 5 1.4 This Book 6 1.5 References 7 2 Video Formats and Quality 9 2.1 Introduction 9 2.2 Natural Video Scenes 9 2.3 Capture 10 2.3.1 Spatial Sampling 11 2.3.2 Temporal Sampling 11 2.3.3 Frames and Fields 13 2.4 Colour Spaces 13 2.4.1 RGB 14 2.4.2 YCbCr 15 2.4.3 YCbCr Sampling Formats 17 2.5 Video Formats 19 2.6 Quality 20 2.6.1 Subjective Quality Measurement 21 2.6.2 Objective Quality Measurement 22 2.7 Conclusions 24 2.8 References 24
CONTENTS 3 Video Coding Concepts 3.1 Introduction 3.2 Video COdEc 3.3 Temporal Model 3.3.1 Prediction from the previous video frame 3.3.2 Changes due to motion 80002 3.3 Block-based Motion Estimation and Compensation 3.3.4 Motion Compensated Prediction of a Macroblock 3.3.5 Motion Compensation Block Size 3.3.6 Sub-pixel Motion Compensation 3.3.7 Region-based Motion Con 3.4 Image model 3.4.1 Predictive Image Coding 3. 4.2 Transform Coding 4.3 Quantisation 3.4.4 Reordering and zero encoding 3.5 Entropy Code 3.5.1 Predictive Coding 3.5.2 Variable-length Coding 662 3.5.3 Arithmetic Odin 3.6 The Hybrid DPCM/DCT Video CODEC Mode 3.7 Conclusions 3. 8 References 4 The MPeg-4 and h.264 Standards 4.1 Introduction 4.2 Developing the Standards 4.2.1 ISO MPEg 4.2.2 ITU-T VCEG 4.2.3JT 4.2.4 Development History 4.2.5 Deciding the Content of the Standards 4.3 Using the standards 4.3.1 What the Standards Cove 4.3.2 Decoding the standards 6888880092 4.3.3 Conforming to the standards 4.4 Overview of mPeg-4 Visual/Part 2 4.5 Overview of h. 264/ MPeg-4 Part 10 4.6 Comparison of MPEG-4 Visual and H. 264 4.7 Related Standards 4.7.1 JPEG and JPEG2000 95 4.7.2 MPEG-1 and MPEG-2 4.7.3H26 I andh263 96 4.7. 4 Other Parts of MPEg-4 4. 8 Conclusions
•viii CONTENTS 3 Video Coding Concepts 27 3.1 Introduction 27 3.2 Video CODEC 28 3.3 Temporal Model 30 3.3.1 Prediction from the Previous Video Frame 30 3.3.2 Changes due to Motion 30 3.3.3 Block-based Motion Estimation and Compensation 32 3.3.4 Motion Compensated Prediction of a Macroblock 33 3.3.5 Motion Compensation Block Size 34 3.3.6 Sub-pixel Motion Compensation 37 3.3.7 Region-based Motion Compensation 41 3.4 Image model 42 3.4.1 Predictive Image Coding 44 3.4.2 Transform Coding 45 3.4.3 Quantisation 51 3.4.4 Reordering and Zero Encoding 56 3.5 Entropy Coder 61 3.5.1 Predictive Coding 61 3.5.2 Variable-length Coding 62 3.5.3 Arithmetic Coding 69 3.6 The Hybrid DPCM/DCT Video CODEC Model 72 3.7 Conclusions 82 3.8 References 83 4 The MPEG-4 and H.264 Standards 85 4.1 Introduction 85 4.2 Developing the Standards 85 4.2.1 ISO MPEG 86 4.2.2 ITU-T VCEG 87 4.2.3 JVT 87 4.2.4 Development History 88 4.2.5 Deciding the Content of the Standards 88 4.3 Using the Standards 89 4.3.1 What the Standards Cover 90 4.3.2 Decoding the Standards 90 4.3.3 Conforming to the Standards 91 4.4 Overview of MPEG-4 Visual/Part 2 92 4.5 Overview of H.264 / MPEG-4 Part 10 93 4.6 Comparison of MPEG-4 Visual and H.264 94 4.7 Related Standards 95 4.7.1 JPEG and JPEG2000 95 4.7.2 MPEG-1 and MPEG-2 95 4.7.3 H.261 and H.263 96 4.7.4 Other Parts of MPEG-4 97 4.8 Conclusions 97 4.9 References 98