Share E-Book

Master Photo and Video Editing with Metal A Practical Approach to Leveraging Metal Media Editing Software (Bogdan Redkin, Victor Yaskevich)(Z-Library)

Author Bogdan Redkin, Victor Yaskevich

technology
Language English

Delve into the nuances of photo and video editing with Metal, a framework from Next Generation GPU APIs. Right now, the demand for media editors is growing exponentially, with multiple applications needing some form of image processing, including messengers, social networks, marketplace, and banking applications. This book provides detailed guidelines for reimplementation instruments from one of the more popular photo and video editors. Begin your journey by reviewing the rationale for using Metal, and an overview of the reasons why this this is the best performance solution. Rasterization is then covered to provide a basis for understanding how image editing in Metal works. You’ll look at aspects of image processing such as rendering, image transformations, and working with textures. This knowledge then leads you to image editing, where it is applied to make basic color adjustments, shadows, blur, vignette, and color correction with LUT filters. These are fundamental aspects of any media editing software. Layers make up the final section of the book, including different compositions and blend modes, both essential tools for any image editor. You’ll conclude the journey with a look at video editing with Metal. Through hands-on projects in each chapter, you will learn how to apply these techniques directly in real-world scenarios, giving a great starting point to implement any kind of media processing in your own applications. What You Will Learn Understand fundamental concepts of GPU rendering to complex image and video processing techniques See how shaders are accessed in the rendering pipeline Create and import textures Review image and video editing techniques, from simple color adjustment to complex filters, layer composition, and real-time video effects Who This Book Is For Intermediate Swift developers interested in photo and video editing or diving deeper into understanding how GPU media processing works.

Format PDF
Size 11.0 MB
11
Views
0
Downloads
0.00
Total Donations
(First 20 pages)

Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Page 1
(This page has no text content)
Page 2
Master Photo and Video Editing with Metal A Practical Approach to Leveraging Metal Media Editing Software Bogdan Redkin Victor Yaskevich
Page 3
Master Photo and Video Editing with Metal: A Practical Approach to Leveraging Metal Media Editing Software ISBN-13 (pbk): 979-8-8688-0831-9 ISBN-13 (electronic): 979-8-8688-0832-6 https://doi.org/10.1007/979-8-8688-0832-6 Copyright © 2024 by Bogdan Redkin and Victor Yaskevich This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein. Managing Director, Apress Media LLC: Welmoed Spahr Acquisitions Editor: Spandana Chatterjee Desk Editor: James Markham Editorial Project Manager: Kripa Joseph Copyeditor: Kim Burton Cover designed by eStudioCalamar Cover image designed by Fancy Tech, LLC Distributed to the book trade worldwide by Springer Science+Business Media New York, 1 New York Plaza, Suite 4600, New York, NY 10004-1562, USA. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation. For information on translations, please e-mail booktranslations@springernature.com; for reprint, paperback, or audio rights, please e-mail bookpermissions@springernature.com. Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales web page at http://www.apress.com/bulk-sales. Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub. For more detailed information, please visit https://www.apress.com/gp/ services/source-code. If disposing of this product, please recycle the paper Bogdan Redkin Buenos-Aires, Argentina Victor Yaskevich Warszawa, Poland
Page 4
(This page has no text content)
Page 5
(This page has no text content)
Page 6
(This page has no text content)
Page 7
(This page has no text content)
Page 8
(This page has no text content)
Page 9
(This page has no text content)
Page 10
(This page has no text content)
Page 11
(This page has no text content)
Page 12
xi About the Authors Bogdan Redkin is an iOS developer with over ten years of experience creating top-notch iOS applications. As a founder of Fancy Tech, he launched multiple photo-editing solutions, achieving leading positions in the App Store. Having written many articles on Medium about drawing using Metal, he’s decided to combine his passion for writing and GPU image processing by writing his first book. Victor Yaskevich is an experienced GPU programmer specializing in Vulkan, Metal, and shaders. With a strong focus on low- level graphics and system programming, he contributes his expertise to guide readers in mastering GPU programming and architecture patterns throughout this book.
Page 13
xiii Acknowledgments Many thanks to those who supported me during my writing journey. I’m deeply indebted to my co-author, Victor, whose knowledge and expertise in GPU programming helped us create a book with more detail, depth, and value. Thanks goes to David, a wordsmith who shepherded me in the literary arts. Immense gratitude goes to my wife, Victoria, who always inspired and supported me throughout the entire process.
Page 14
3© Bogdan Redkin and Victor Yaskevich 2024 B. Redkin and V. Yaskevich, Master Photo and Video Editing with Metal, https://doi.org/10.1007/979-8-8688-0832-6_1 CHAPTER 1 Introduction In a world increasingly driven by visual content, the ability to manipulate and enhance images and videos has become a must-have skill set for iOS engineers. More and more applications, including social networks, have built-in editing tools, with Apple consistently highlighting camera and photo app improvements at every event. Achieving smooth image and video editing performance has never been so vital. Have you ever wondered how you could keep up with this or the capabilities of the Metal framework? Welcome to Mastering Photo and Video Editing with Metal! This book teaches the art of image and video editing techniques, from simple color adjustment to complex filters and real-time video effects. As you progress in your learning journey, each chapter provides a thorough theoretical explanation and real-world examples, with the final project containing essential instruments from modern photo editors (see Figure 1-1).
Page 15
4 Figure 1-1. A screenshot of the final example project containing all the instruments explained in the book By the end of this book, you’ll have an understanding of how to implement editing tools using Metal as well as being able to apply this knowledge to your own app by referencing to the final example project. What Is Metal? Metal is a low-level, unified, and low-overhead application programming interface (API) developed by Apple for utilizing the graphics processing unit (GPU). It provides near-direct access to the GPU, allowing for efficient rendering, parallel processing, and optimized use of the GPU’s power. It is particularly suited for 3D graphics, data-parallel computation, gaming, video processing, machine learning, and image/video rendering applications. Chapter 1 IntroduCtIon
Page 16
5 In addition, it’s also used in many of Apple’s frameworks, including RealityKit, SceneKit, SpriteKit, and CoreImage. History Overview The story of GPU processing on Apple devices begins with the introduction of OpenGL for Macs in 1999, providing substantial graphics capability primarily for 3D gaming and professional applications. However, as the demand for more sophisticated graphics grew—especially with the advent of mobile computing—Apple recognized the need for a more optimized, low-overhead API that could maximize the performance of their hardware. This realization culminated in the launch of Metal in 2014 with iOS 8. Unlike the previous solutions, Metal was designed specifically for Apple’s Hardware with stunning results - up to 10x faster draw call rates! Furthermore, Metal offers developers revolutionary capabilities of computing GPU power and precompiled shaders. Who Is This Book For? You could be an intermediate Swift developer interested in photo and video editing or how GPU media processing works, for example. You should have a basic knowledge of C++ or C, but it’s not essential. However, you must use the Metal Shader Language in the GPU shader functions, which is based on C++. How to Read This Book Each chapter includes a starter project and explains one of the editing tools in detail. If you’re already familiar with Metal on a basic level, you can jump to any tool, learn from a particular explanation of how the tool works, and compare your result with the final project. Chapter 1 IntroduCtIon
Page 17
6 However, beginners who haven’t worked with the Metal framework should proceed from the start of the book. Overview • Part I: The book starts with the Metal fundamentals, understanding the rendering pipeline, core components, shader functions, and coordinate space. After that, you’ll learn how to load custom images and convert them to metal textures. Then, you’ll be introduced to transforming, rotating, and moving your textures. • Part II: This part of the book explains how to apply such effects as color adjustments, including ones based on the lookup table, blur, and image distortion. • Part III: Your journey accumulates all your learned knowledge and extends it to the possibility of applying image editing effects to layers and composing layers with different blend modes. • Part IV: The final section builds on your knowledge of working with static images, introducing techniques of video editing with Metal by processing each frame with previously learned transformations and effects. Chapter 1 IntroduCtIon
Page 18
7© Bogdan Redkin and Victor Yaskevich 2024 B. Redkin and V. Yaskevich, Master Photo and Video Editing with Metal, https://doi.org/10.1007/979-8-8688-0832-6_2 CHAPTER 2 Metal Fundamentals Overview: Rendering and Displaying Content Your learning journey begins with the fundamentals of rendering with Metal. This chapter begins with a theoretical introduction to components used for rendering content. You’ll become familiar with the MetalKit framework, designed to simplify working with Metal by offering higher- level abstractions. After that, you get a quick introduction to concepts of the rendering pipeline and Metal’s command submission model. By the end of this chapter, you’ll implement a rendering canvas with randomizing background color updates, as shown in Figure 2-1.
Page 19
8 Figure 2-1. The rendering canvas with randomizing background color updates Rendering Rendering is the process of computing frame pixel colors through the GPU. The rendering result is the frame displayed on the screen. The diagram shown in Figure 2-2 represents a sequence of events that leads to a rendered frame. Figure 2-2. The sequence of events that leads to a rendered frame 1. Initialize Metal. Prepare MTKView or CAMetalLayer to display the result drawn with Metal on the screen. Set up the delegate for callbacks from MTKView. 2. Prepare resources. This chapter does not use external resources. However, later in this book, you will load textures, models, shader vertex, and fragment functions. This step is not part of a frame drawing loop and should be used only when the rendering pipeline state needs to be updated. Chapter 2 Metal FundaMentals Overview: rendering and displaying COntent
Page 20
9 3. Set up the pipeline. Configure the rendering pipeline state with prepared resources. 4. Render. Set the configured rendering pipeline stat for the render command encoder. Then, if any of the shader functions can receive arguments, the encoder is updated with new data from the buffer or a texture. This is a highly generalized description of the rendering in metal to make the first acquaintance smoother. In more complex applications, each of these events has more stages and operations underneath, and later in this book, you’ll decompose and explore them in more detail. GPU Devices MTLDevice represents an abstraction of the GPU and serves as the primary entry point for your app’s interaction. An MTLDevice instance is required to access anything from the GPU. Therefore, essential classes such as MTLRenderPipelineState, MTKView, and MTLCommandQueue require either a metal device instance or a different class that contains it. Getting a GPU Device To get a default Metal device, call the MTLCreateSystemDefaultDevice() function. If there is only one GPU, such as those in iOS devices, you can always use the default device. let device = MTLCreateSystemDefaultDevice()! The system default is the discrete GPU on macOS devices with multiple GPUs. Chapter 2 Metal FundaMentals Overview: rendering and displaying COntent
The above is a preview of the first 20 pages. Register to read the complete e-book.

Recommended for You

Loading recommended books...
Failed to load, please try again later

Tip the Site

Scan the WeChat Pay or Alipay code to tip. No login required.

WeChat Pay
Alipay
Back to List