SMPTE RDD 15-2007 Software Scripting Language for Pixel-Based Color Transformations《基于像元颜色转换的软件脚本语言》.pdf

上传人:bowdiet140 文档编号:1046309 上传时间:2019-03-27 格式:PDF 页数:63 大小:403.82KB
下载 相关 举报
SMPTE RDD 15-2007 Software Scripting Language for Pixel-Based Color Transformations《基于像元颜色转换的软件脚本语言》.pdf_第1页
第1页 / 共63页
SMPTE RDD 15-2007 Software Scripting Language for Pixel-Based Color Transformations《基于像元颜色转换的软件脚本语言》.pdf_第2页
第2页 / 共63页
SMPTE RDD 15-2007 Software Scripting Language for Pixel-Based Color Transformations《基于像元颜色转换的软件脚本语言》.pdf_第3页
第3页 / 共63页
SMPTE RDD 15-2007 Software Scripting Language for Pixel-Based Color Transformations《基于像元颜色转换的软件脚本语言》.pdf_第4页
第4页 / 共63页
SMPTE RDD 15-2007 Software Scripting Language for Pixel-Based Color Transformations《基于像元颜色转换的软件脚本语言》.pdf_第5页
第5页 / 共63页
点击查看更多>>
资源描述

1、 Copyright 2007 by THE SOCIETY OF MOTION PICTURE AND TELEVISION ENGINEERS 595 W. Hartsdale Ave., White Plains, NY 10607 (914) 761-1100 Approved September 24, 2007 The attached document is a Registered Disclosure Document prepared by the proponent identified below. It has been examined by the appropr

2、iate SMPTE Technology Committee and is believed to contain adequate information to satisfy the objectives defined in the Scope, and to be technically consistent. This document is NOT a Standard, Recommended Practice or Engineering Guideline, and does NOT imply a finding or representation of the Soci

3、ety. Errors in this document should be reported to the proponent identified below, with a copy to engsmpte.org. All other inquiries in respect of this document, including inquiries as to intellectual property requirements that may be attached to use of the disclosed technology, should be addressed t

4、o the proponent identified below. Proponent contact information: Science and Technology Council Academy of Motion Picture Arts and Sciences 8949 Wilshire Blvd. Beverly Hills, CA 90211 USA Email: councilinfooscars.org NOTICE The technology described in this Registered Disclosure Document may be the s

5、ubject of intellectual property rights (including patent, copyright, trademark or similar such rights) of the proponent or others. The proponent declares that it will not enforce any applicable intellectual property rights owned or controlled by the proponent against any person or entity using the i

6、ntellectual property to comply with this Registered Disclosure Document. Attention is drawn to the possibility that some elements of the technology described in this document, or certain applications of the technology may be the subject of intellectual property rights other than those identified abo

7、ve. Neither the proponent nor SMPTE shall be held responsible for identifying any or all such rights. Recipients of this document are invited to submit notification to the proponent of any such intellectual property of which they are aware. Page 1 of 63 pages RDD 15-2007SMPTE REGISTERED DISCLOSURE D

8、OCUMENT Software Scripting Language for Pixel-Based Color Transformations RDD 15-2007 Page 2 of 63 pages Table of Contents Page Foreword 4 1 Scope 5 2 Normative References 5 3 Introduction. 5 3.1 Motivation 5 3.2 What CTL Is. 6 3.3 What CTL Is Not 6 3.4 This Document 6 4 Overview of CTL. 7 4.1 Basic

9、 Concepts 7 4.2 Input and Output, Varying and Uniform. 8 4.3 Data Types 9 4.4 Arrays, Static Data, Lookup Tables.10 4.5 Scattered Data Interpolation12 4.6 Standard Library 13 4.7 Modules .13 5 Description of the CTL Interpreter 14 5.1 Theory of Operation.14 5.2 C+ API .15 5.3 FuntionCall and Functio

10、nArg Objects18 5.4 DataType Objects19 5.5 ArrayType and StructType Objects .20 5.6 Error Handling22 5.7 Breaking Infinite Loops22 5.8 Thread-Safety and Parallelism 22 5.9 Accelerating the Transforms23 6 Design Decisions23 6.1 Limited Set of Language Features 23 6.2 No Support for Executive-Only Colo

11、r Transforms.24 6.3 Portability.24 6.4 SIMD Back End .24 6.5 Security24 7 CTL Language Reference 25 7.1 Syntactic Notation25 7.2 Lexical Elements .25 7.2.1 Keywords.25 7.2.2 Punctuators .26 7.2.3 Literals .27 7.3 Basic Concepts27 7.3.1 Varying Values 27 7.3.2 What is a CTL Program.28 RDD 15-2007 Pag

12、e 3 of 63 pages 7.3.3 Modules. 28 7.3.4 CTL Versions 28 7.3.5 Name Spaces 29 7.3.6 Name Spaces 30 7.3.7 Scope 31 7.3.8 Initialization of Constants, Evaluation of Constant Expressions. 31 7.3.9 Types 31 7.3.10 Const Qualifier 32 7.3.11 Type Conversion. 32 7.4 Definitions . 33 7.4.1 Struct Type Defini

13、tions 33 7.4.2 Variable Definitions . 33 7.4.3 Function Definitions 34 7.5 Statements 37 7.5.1 Compound Statements . 38 7.5.2 While Statements 38 7.5.3 For Statements . 38 7.5.4 If Statements. 39 7.5.5 Assignments 39 7.5.6 Expression Statements. 40 7.5.7 Null Statements. 40 7.5.8 Print Statements .

14、40 7.5.9 Return Statements 41 7.6 Expressions. 41 7.6.1 Primary Expressions . 42 7.6.2 Arithmetic Expressions . 42 7.7 Standard Library 44 7.7.1 Numeric Constants . 44 7.7.2 Floating-Point Number Classification 44 7.7.3 Elementary Functions . 45 7.7.4 Operations on 3D Vectors, 3x3 Matrices and 4x4 M

15、atrices . 47 7.7.5 Lookup Tables and Scattered Data Interpolation . 49 7.7.6 Conversions Between Standard Color Spaces. 51 7.7.7 Assertion . 52 7.8 Complete Grammar. 53 Annex A Simplified API for OpenEXR (Informative) . 58 A.1 C+ Interface 58 A.2 Matching CTL Parameters, Image Channels and Header At

16、tributes . 59 A.3 Translation Between CTL Types, Channel Types and Attribute Types . 60 Annex B Source Code (Informative) . 62 Annex A Sample Code and Utilities (Informative). 63 RDD 15-2007 Page 4 of 63 pages Foreword SMPTE (the Society of Motion Picture and Television Engineers) is an internationa

17、lly-recognized standards developing organization. Headquartered and incorporated in the United States of America, SMPTE has members in over 80 countries on six continents. SMPTEs Engineering Documents, including Standards, Recommended Practices, Engineering Guidelines and Registered Disclosure Docum

18、ents, are prepared by SMPTEs Technology Committees. Participation in these Committees is open to all with a bona fide interest in their work. SMPTE cooperates closely with other standards-developing organizations, including ISO, IEC and ITU. SMPTE Registered Disclosure Documents are drafted in accor

19、dance with the rules given in Part XIII of its Administrative Practices. SMPTE Registered Disclosure Document RDD 15 was prepared by Technology Committee DC28. RDD 15-2007 Page 5 of 63 pages 1 Scope This document describes the Color Transformation Language, or CTL, and its reference implementation i

20、n the form of a CTL interpreter. CTL is a small software programming language that has been designed to serve as a building block for digital color management systems. CTL allows users to describe color transforms in a concise and unambiguous way by expressing them as software programs. Any digital

21、color management system that supports CTL includes a CTL interpreter. In order to apply a given transform to an image, the color management system instructs the interpreter to load and run the CTL program that describes the transform. The original and the transformed image constitute the CTL program

22、s input and output. This document describes the syntax and semantics of CTL, a standard library of functions that can be called from within CTL programs, as well as a C+ programming interface that allows application programs to access and control the CTL interpreter. The RDD itself is comprised of t

23、his document and the reference implementation of the CTL interpreter as described in Annex B. All other referenced documents, sample code and software utilities are provided for informative purposes only. 2 Normative References The following standards contain provisions which, through reference in t

24、his text, constitute provisions of this registered disclosure document. At the time of publication, the editions indicated were valid. All standards are subject to revision, and parties to agreements based on this registered disclosure document are encouraged to investigate the possibility of applyi

25、ng the most recent edition of the standards indicated below. ISO/IEC 9899:1999, Programming Languages C ISO/IEC 14882:2003, Programming languages C+ ITU-R BT.709-5, Parameter Values for the HDTV Standards for Production and International Programme Exchange CIE15:2004, Colorimetry, 3rd ed. 3 Introduc

26、tion 3.1 Motivation Digital color management requires translating digital images among different representations or color spaces. For example, the pixels in an image may encode the colors that should be seen when the image is displayed on a video monitor. Printing this image on paper or recording it

27、 on motion picture film requires transforming the pixels to an appropriate representation: Video, inks on paper and film all have different color gamuts and dynamic ranges. Color mixing is additive for video, but subtractive for inks and film. Video and film typically use three color channels, while

28、 four or more inks are used for printing on paper. A color management system must transform each pixel in the original image to corresponding amounts of ink or film density values. The details of how each pixel is transformed can be fairly complex, and they are often subject to artistic decisions. W

29、hen images are exchanged between different people or companies, it is often desirable to exchange exact descriptions of appropriate color transforms along with the digital image files. Two companies whose offices are in different geographical locations may each have a copy of the same digital image

30、file. When one of the companies prints the image on paper, they want to be sure that they get the same result as the other company. In order to achieve identical results, the companies must agree on details of the printing process (for example, inks and paper), and they must agree on the transform t

31、hat converts pixels in the file into amounts of ink on paper. Of course, this requires a description of the transform. RDD 15-2007 Page 6 of 63 pages 3.2 What CTL Is The Color Transformation Language, or CTL, is a small programming language that was designed to serve as a building block for digital

32、color management systems. CTL allows users to describe color transforms in a concise and unambiguous way by expressing them as programs. Any digital color management system that supports CTL includes a CTL “interpreter“, a software program that performs CTL-described operations on pixels that make u

33、p an image. In order to apply a given transform to an image, the color management system instructs the interpreter to load and run the CTL program that describes the transform. The original and the transformed image constitute the CTL programs input and output. Color transforms can be shared by dist

34、ributing CTL programs. Two parties with the same CTL program can apply the same transform to an image. In addition to the original image, a CTL program can have input parameters whose settings affect how the input image will be transformed. For example, a transform may have an “exposure“ parameter,

35、such that changing the exposure makes the image brighter or darker. In order to guarantee identical results, parties that have agreed to use a particular transform must also agree on the settings for the transforms parameters. General-purpose programming languages such as C, C+ or Python could of co

36、urse be used to describe color transforms, but code written in those languages is not a suitable format for transform interchange. Some languages require the recipient to explicitly compile and link a programs source code before the program can be executed. Code must be carefully written in order to

37、 make it portable across different operating systems. If code is executed inside a larger application, bugs can cause the application to malfunction. In addition, with most general-purpose programming languages, reliable protection from viruses and Trojan horses is very difficult to achieve. A domai

38、n-specific programming language such as CTL can be designed to allow only the kinds of operations that are needed to describe color transforms. This improves the portability of programs, protects users against application software crashes and malicious code, and permits efficient interpreter impleme

39、ntations. 3.3 What CTL Is Not A CTL interpreter is not a color management system; it is merely a software component that can be used as a part of such a system. The interpreter transforms images by executing CTL programs, but only when invoked by the rest of the system. The interpreter does not deci

40、de which programs to run and when, or what the settings for a transforms parameters should be. CTL is a mechanism that can be used to implement any number of color management policies, but it does not by itself define a particular policy. Also, CTL is not a general-purpose image processing language.

41、 CTL programs are restricted to performing color space transforms or other single-pixel operations. It is not possible to express operations such as convolving an image with a filter kernel, or computing the sum of all pixels in an image. 3.4 This Document This document describes the CTL language an

42、d the reference implementation of the CTL interpreter. Section 4 provides an overview of the language. It should give the reader enough background to start writing CTL programs and understand their use. Section 5 describes the reference implementation of the interpreter for the language for readers

43、who are integrating the reference CTL interpreter into their C+ applications. Section 6 provides more information on the implementation, and Section 7 provides a programming reference guide for CTL. This document assumes that the reader is familiar with the C and C+ programming languages and with ba

44、sic digital imaging concepts. RDD 15-2007 Page 7 of 63 pages The reference implementation is designed so that it is easy to interpret CTL properly using the provided parser and framework in combination with a custom program execution engine. Implementers who choose to re-implement the entire interpr

45、eter should produce the same behavior and results as the reference interpreter. In the event that discrepancies are found between the language reference in Section 6 and the reference implementation, the reference implementation should be considered the specification. 4 Overview of CTL In order to m

46、ake CTL programs look familiar to people who are used to programming in C or C+, the syntax of CTL was deliberately made similar to C. However, there are significant differences. Below, the main features of CTL are introduced by showing a number of code samples. 4.1 Basic Concepts The first example

47、is a CTL transform that adjusts the overall brightness of an image according to an “exposure“ parameter: void adjustExposure (output varying half rOut, output varying half gOut, output varying half bOut, input varying half r, input varying half g, input varying half b, input uniform float e = 0) flo

48、at f = pow (2, e); rOut = r * f; gOut = g * f; bOut = b * f; In CTL, a transform is expressed as a function that describes the operations that must be performed on an individual pixel. In order to apply the transform to an image, the CTL interpreter calls the function once for each pixel. The adjust

49、Exposure() function expects as inputs an image with three channels, r, g, and b, and an exposure value, e. The function multiplies all pixels by 2e, thus making the image brighter or darker. (If the data in the pixels represent linear scene luminance values, then this operation is equivalent to changing the aperture of the iris on the cameras lens by e f-stops.) The result is a new image with three channels, rOut, gOut and bOut. Most CTL functions have parameters. Input parameters supply input data, and results are returned via output paramet

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 标准规范 > 国际标准 > 其他

copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1