METHOD AND APPARATUS FOR VERTICALLY SCALING PIXEL DATA
CROSS-REFERENCE TO RELATED APPLICATIONS
[0001] This application is a continuation-in-part of co-pending U.S. patent application Serial No. 10/825,259, Attorney Docket No. NVDA/P000715, entitled MINIMALIST COLOR SPACE CONVERTERS FOR OPTIMIZING IMAGE PROCESSING OPERATIONS by W. Young, filed April 15, 2004, which is incorporated herein by reference.
BACKGROUND OF THE INVENTION
Field of the Invention [0002] Embodiments of the present invention generally relate to a method and apparatus for vertically scaling pixel data.
Description of the Related Art
[0003] A vertical sealer is generally designed to change the number of input lines to a different number of output lines in the output video signal. A vertical sealer can either scale up or down. A line generally refers to a video horizontal scan line. The process of vertical scaling can be complicated, particularly because the incoming pixel data is in line format. Vertical scaling typically requires comparison and calculations between many adjacent lines of pixel data. Because of the nature of the incoming pixel data in rasterized format, the previous and current line must be stored until the next line becomes available. These lines are typically stored in a line store memory, which consists of one or more random access memories (RAM's). The size of each RAM is determined by the number of lines to be stored and the length of each line. Since every line corresponding to the full width of the image may need to be stored in the line store memory in preparation for vertical scaling, the size of the line store memory can become quite large, thereby making the vertical scaling operation an expensive process.
[0004] Therefore, a need exists in the art for a more cost effective method and apparatus for vertically scaling pixel data.
SUMMARY OF THE INVENTION
[0005] An objective of various embodiments of the invention is to reduce the amount of pixel data that needs to be stored in a line store memory in connection with scaling the pixel data vertically.
[0006] Various embodiments of the present invention are generally directed to an image processing apparatus, which includes a red, green and blue (RGB) color space to luminance color, blue color difference and red color difference (YCbCr) color space converter module for converting a line of pixels from the RGB color space to the YCbCr color space. The line of pixels has a first sampling rate. The image processing apparatus further comprises a chrominance decimator module coupled to the RGB to YCbCr color space converter module. The chrominance decimator module is configured to generate an intermediate representation of the line of pixels having a second sampling rate that is less than the first sampling rate. The amount of data representing the intermediate representation is less than the amount of data representing the line of pixels. The image processing apparatus further comprises a line store memory coupled to the chrominance decimator module. The line store memory is configured to store the intermediate representation. The image processing apparatus further comprises a vertical sealer module coupled to the line store memory. The vertical sealer module is configured to generate a scaled version of the intermediate representation.
[0007] In one embodiment, the image processing apparatus further comprises a chrominance interpolator module coupled to the vertical sealer module. The chrominance interpolator module is configured to convert the scaled version of the intermediate representation having the second sampling rate to a scaled version of the line of pixels having the first sampling rate.
[0008] In another embodiment, the image processing apparatus further comprises a YCbCr to RGB color space converter module coupled to the chrominance interpolator module. The YCbCr to RGB color space converter module is configured to convert the scaled version of the line of pixels from the YCbCr color space to the RGB color space.
[0009] In yet another embodiment, the RGB to YCbCr color space converter module determines a luminance color component (Y) of the pixel data by adding VS of a red color (R) component of the pixel data to Λ of a green color (G) component of the pixel data and of a blue color (B) component of the pixel data. The RGB to YCbCr color space converter module further determines a blue color difference component (Cb) of the pixel data by subtracting the luminance color component (Y) of the pixel data from the blue color (B) component, and dividing the result by two. The RGB to YCbCr color space converter module further determines a red color difference component (Cr) of the pixel data by subtracting the luminance color component (Y) of the pixel data from the red color (R) component of the pixel data and dividing the result by two.
[0010] In still another embodiment, the YCbCr to RGB color space converter module determines the red color (R) component of the pixel data by adding the luminance color component (Y) to twice the red color difference component (Cr) of the pixel data. The YCbCr to RGB color space converter module further determines the green color (G) component of the pixel data by subtracting the red color difference component (Cr) and the blue color difference component (Cb) of the pixel data from the luminance color component (Y) of the pixel data. The YCbCr to RGB color space converter module further determines the blue color (B) component of the pixel data by adding the luminance color component (Y) of the pixel data to twice the blue color difference component (Cb) of the pixel data.
BRIEF DESCRIPTION OF THE DRAWINGS
[0011] So that the manner in which the above recited features of the present invention can be understood in detail, a more particular description of the invention, briefly summarized above, may be had by reference to embodiments, some of which are illustrated in the appended drawings. It is to be noted, however, that the appended drawings illustrate only typical embodiments of this invention and are therefore not to be considered limiting of its scope, for the invention may admit to other equally effective embodiments.
[0012] Figure 1 illustrates a simplified block diagram of a computer system according to an embodiment of the present invention.
[0013] Figure 2 is a flow diagram of a method for converting pixel data from an RGB space to a YCbCr space in accordance with one embodiment of the invention.
[0014] Figure 3A illustrates a logic diagram for determining the luminance color component (Y) of the pixel data in accordance with one embodiment of the invention.
[0015] Figure 3B illustrates a logic diagram for determining the blue color difference component (Cb) of the pixel data in accordance with one embodiment of the invention.
[0016] Figure 3C illustrates a logic diagram for determining the red color difference component (Cr) of the pixel data in accordance with one embodiment of the invention.
[0017] Figure 4 illustrates a flow diagram of a method for vertically scaling pixel data in accordance with one embodiment of the invention.
[0018] Figure 5 illustrates a flow diagram of a method for converting pixel data from the YCbCr space to the RGB space in accordance with one embodiment of the invention.
[0019] Figure 6A illustrates a logic diagram for determining the red color component (R) of the pixel data in accordance with one embodiment of the invention.
[0020] Figure 6B illustrates a logic diagram for determining the green color component (G) of the pixel data in accordance with one embodiment of the invention.
[0021] Figure 6C illustrates a logic diagram for determining the blue color component (B) of the pixel data in accordance with one embodiment of the invention.
DETAILED DESCRIPTION
[0022] Figure 1 illustrates a simplified block diagram of a computer system 100 according to an embodiment of the present invention. The computer system 100 includes a central processing unit (CPU) 102 and a system (main) memory 104 communicating via a system bus 106. User input is received from one or more user input devices 108 (e.g., keyboard, mouse) coupled to the system bus 106. Visual output is provided on a pixel based display device 1 10 (e.g., a conventional CRT, TV or LCD based monitor, projector, etc.) operating under control of a graphics
processing unit (GPU) 112 coupled to the bus 106. Other components, such as one or more storage devices 128 (e.g., a fixed or removable magnetic disk drive, compact disk (CD) drive, and/or DVD drive), may also be coupled to the system bus 106. In one embodiment, the computer system 100 operates in a red, green and blue (RGB) color space. Although various embodiments of the invention are described herein with reference to the computer system 100 operating in the RGB color space, the invention contemplates the computer system 100 operating in other color spaces, such as YCbCr.
[0023] The system memory 104 stores various programs or applications, such as operating system programs for generating the pixel data to be processed by the GPU
112. Examples of operating system programs 130 include Graphical Device Interface
(GDI) component of the Microsoft Windows operating system. The system memory
104 may further store a graphics driver program for enabling communication with the
GPU 112. The graphics driver program may implement one or more standard application program interfaces (APIs), such as Open GL and Microsoft DirectX, for communication with the GPU 112. By invoking appropriate API function calls, the operating system programs are able to instruct the graphics driver program to transfer the pixel data to the GPU 112 via the system bus 106 and invoke various rendering functions of the GPU 112. Such pixel data are typically stored and represented in binary form. Data transfer operations may be performed using conventional DMA
(direct memory access) or other operations. In one embodiment, the system memory
104 may store pixel data in the RGB color space.
[0024] The computer system 100 further includes a local memory or frame buffer 114 in communication with the GPU 112. The frame buffer 114 stores the pixel data to be read by a scanout control logic and transmitted to the display device 1 10 for display as an image. In one embodiment, the frame buffer 114 stores the pixel data in the RGB color space. Although the frame buffer 114 is shown as distinct and apart from the system memory 104, in some implementations, such as in a Unified Memory Architecture, the frame buffer 114 and the system memory 104 would share the same physical memory devices.
[0025] The GPU 112 includes various components for receiving and processing graphics system commands received via the bus 106. The GPU 112 includes a
memory management unit 120 and a display pipeline 130. The memory management unit 120 reads the pixel data from the frame buffer 114 or the memory 104, places the pixel data in order and transmits the pixel data to the display pipeline 130 for processing.
[0026] The display pipeline 130 is generally used for image processing. The display pipeline 130 may contain various processing modules configured to convert the pixel data into pixel data suitable for displaying on the display device. In an embodiment in which the computer system 100 operates in the RGB color space, the display pipeline 130 may include a module 142 that processes the pixel data in the red green blue (RGB) color space. Examples of processing modules that operate in the RGB color space include brightness control, contrast control and gamma correction.
[0027] In one embodiment, the display pipeline 130 further includes an RGB to YCbCr color space converter module 144, which is configured to convert the pixel data from the RGB color space to the YCbCr space. A detailed description of the operations of the RGB to YCbCr color space converter module 144 is provided in the paragraphs below with reference to Figures 2-3.
[0028] Once the pixel data has been converted to the YCbCr color space, the pixel data may be processed in the YCbCr color space. Accordingly, the display pipeline 130 may further include a chrominance decimator 145, a vertical sealer 146 and a chrominance interpolator 147. The chrominance decimator 145 is configured to reduce the sampling rate of the blue color difference component (Cb) and the red color difference component (Cr) of the pixel data. The chrominance decimator 145 may also be referred to as the chrominance down sampler. The chrominance decimator 145 may also include components commonly known by persons of ordinary skill in the art. For instance, the chrominance decimator 145 may include a low pass filter configured to reduce the bandwidth of the blue color difference component (Cb) and the red color difference component (Cr) of the pixel data. The vertical sealer 146 is configured to vertically scale the pixel data stored in the line store memory 170. The vertical sealer 146 may be any vertical sealer that is commonly known by persons of ordinary skill in the art. The chrominance interpolator 147 is configured to increase the sampling rate of the blue color difference component (Cb) and the red color difference component (Cr) of the pixel data. The chrominance interpolator 147 may
also be referred to as the chrominance up sampler. The chrominance interpolator 147 may also include components commonly known by persons of ordinary skill in the art. For instance, the chrominance interpolator 147 may include a finite impulse response (FIR) filter. The chrominance decimator 145, the vertical sealer 146 and the chrominance interpolator 147 will be described in more detail in the paragraphs below with reference to Figure 4.
[0029] The display pipeline 130 may further include a line store memory 170, which is in communication with the vertical sealer 146. The line store memory 170 stores the pixel data configured to be vertically scaled by the vertical sealer 146. The line store memory 170 may include one or more random access memories (RAM's). Although the line store memory 170 is shown as distinct and apart from the system memory 104 and the frame buffer 114, in some implementations, the line store memory 170, the system memory 104 and the frame buffer 114 may share the same physical memory devices.
[0030] In accordance with one embodiment of the invention, the display pipeline 130 further includes a YCbCr to RGB color space converter module 148, which is configured to convert the pixel data from the YCbCr space to the RGB space. In this manner, the pixel data may be converted back to the RGB space once the processing of the pixel data in the YCbCr space is completed. In one embodiment, the YCbCr to RGB color space converter module 148 converts the pixel data to the RGB space once the pixel data has been vertically scaled. A detailed description of the operations of the YCbCr to RGB color space converter module 148 is provided in the paragraphs below with reference to Figures 5-6.
[0031] Although the display pipeline 130 has been described with reference to include one RGB to YCbCr color space converter module 144 followed by one YCbCr to RGB color space converter module 148, various embodiments of the invention may contemplate the display pipeline 130 having one YCbCr to RGB color space converter module 148 followed by one RGB to YCbCr color space converter module 144 in a computer system that operates in the YCbCr color space. Various embodiments of the invention may also contemplate the display pipeline 130 having any number of RGB to YCbCr color space converter modules 144 and any number of YCbCr to RGB color space converter modules 148.
[0032] In an embodiment in which the pixel data is displayed on a television screen, the display pipeline 130 further includes an industry standard RGB to YCbCr color space converter module 150 to convert the pixel data to the YCbCr space. The industry standard RGB to YCbCr color space converter module 150 operates in connection with a digital to analog converter (DAC) 162 to display the pixel data on the television screen.
[0033] In an embodiment in which the pixel data is displayed on a CRT, the display pipeline 130 further includes a digital to analog converter (DAC) 161 to convert the pixel data from digital to analog prior to being displayed on the CRT.
[0034] It will be appreciated that the computer system 100 is illustrative and that variations and modifications are possible. The computer system 100 may be a desktop computer, server, laptop computer, palm-sized computer, tablet computer, game console, set-top box, personal digital appliance, tethered Internet appliance, portable gaming system, cellular/mobile telephone, computer based simulator, or the like. The display device 110 can be any pixel-based display, e.g., a CRT or LCD monitor, projector, printer, etc. In some instances, multiple display devices (e.g., an array of projectors or CRT monitors) may be supported, with each device displaying a portion of the image data. The display pipeline 130 and the GPU 112 may be on separate chips. The GPU 112 or any of its components may be implemented using one or more programmable processors programmed with appropriate software, application specific integrated circuits (ASICs), other integrated circuit technologies, or any combination of these. In view of the present disclosure, persons of ordinary skill in the art will recognize that the present invention can be embodied in a wide variety of system configurations.
[0035] Figure 2 is a flow diagram of a method 200 for converting pixel data from an RGB space to a YCbCr space in accordance with one embodiment of the invention. At step 210, a luminance color component (Y) of the pixel data is determined using the equation: Y = R/4 + G/2 + B/4, (1 ) where R is the red color component of the pixel data, G is the green color component of the pixel data, and B is the blue color component of the pixel data. The color space coefficient for the red color component is % or 0.25, which is an approximation of
0.299, the color space coefficient for the red color component according to the industry standard color space converter. The color space coefficient for the green color component is VT. or 0.5, which is also an approximation of 0.587, the color space coefficient for the green color component according to the industry standard color space converter. The color space coefficient for the blue color component is % or 0.25, which is also an approximation of 0.114, the color space coefficient for the blue color component according to the industry standard color space converter. Accordingly, the selected color space coefficients used to calculate the luminance color component (Y) according to equation (1 ) are in binary form. Since the color space coefficients are in binary form, the luminance color component (Y) may be calculated using binary arithmetic and avoid the use of multiplication. In this manner, the luminance color component (Y) of the pixel data may be determined in a more relatively inexpensive manner.
[0036] In accordance with one embodiment of the invention, the luminance color component (Y) of the pixel data may be determined according to a logic diagram 310 illustrated in Figure 3A. As such, the luminance color component (Y) of the pixel data is determined by left shifting the green color component by one bit (which is equivalent to a multiplication by two), adding the result to the red color component and the blue color component, and right shifting the entire sum by two bits (which is equivalent to a division by four). In one embodiment, the logical diagram 310 may be refined by performing a numerical rounding operation prior to right shifting the entire sum by two bits. Such numerical rounding may be performed using conventional techniques, such as adding a value equal to 2 raised to the power of the number of shifted bits minus 1 (i.e., 2(s"1), where s is the number of shifts) to the entire sum prior to right shifting the entire sum. Left shifting and right shifting operations are free to implement from a cost and computational resource perspectives. Accordingly, the luminance color component (Y) of the pixel data may be determined in a relatively inexpensive manner using the left and right shifting operations described in logic diagram 310.
[0037] At step 220, a blue color difference component (Cb) of the pixel data is determined using the equation: Cb = (B-Y)/2, (2) where B is the blue color component of the pixel data and Y is the luminance color component (Y) of the pixel data determined at step 210. Like the color coefficients
used in equation (1 ), the color space coefficients used to determine the blue color difference component (Cb) in equation (2) are an approximation of the color space coefficients used to determine the blue color difference component (Cb) according to the industry standard color space converter. In this manner, the color space coefficients used to determine the blue color difference component (Cb) according to equation (2) may be put in binary form. Since the color space coefficients are in binary form, the blue color difference component (Cb) of the pixel data may be calculated using binary arithmetic and avoid the use of multiplication. In this manner, the blue color difference component (Cb) of the pixel data may be determined in a more relatively inexpensive manner.
[0038] In accordance with one embodiment of the invention, the blue color difference component (Cb) of the pixel data may be determined according to a logic diagram 320 illustrated in Figure 3B. As such, the blue color difference component (Cb) of the pixel data is determined by subtracting the luminance color component (Y) of the pixel data determined at step 210 from the blue color component of the pixel data and right shifting the sum by one bit (which is equivalent to a division by two). In one embodiment, a numerical rounding operation may be performed prior to right shifting the sum by one bit. As mentioned above, since right shifting operations are free to implement, the blue color difference component (Cb) of the pixel data may be determined in a relatively inexpensive manner using the right shifting operation described in logic diagram 320.
[0039] At step 230, a red color difference component (Cr) of the pixel data is determined using the equation: Cr = (R-YV2, (3) where R is the red color component of the pixel data and Y is the luminance color component of the pixel data determined at step 210. As in steps 210 and 220, the color space coefficients used to determine the red color difference component (Cr) according to equation (3) are also an approximation of the industry standard color coefficients so that they may be put in binary form. Since the color coefficients are in binary form, the red color difference component (Cr) of the pixel data may be calculated using binary arithmetic and avoid the use of multiplication. In this manner, the red color difference component (Cr) of the pixel data may be determined in a more relatively inexpensive manner.
[0040] In accordance with one embodiment of the invention, the red color difference component (Cr) of the pixel data may be determined according to a logic diagram 330 illustrated in Figure 3C. Referring to Figure 3C, the red color difference component (Cr) of the pixel data is determined by subtracting the luminance color component (Y) of the pixel data from the red color component of the pixel data and right shifting the result by one bit (which is equivalent to a division by two). In one embodiment, a numerical rounding operation may be performed prior to right shifting the result by one bit. As mentioned above, since right shifting operations are free to implement, the red color difference component (Cr) of the pixel data may be determined in a relatively inexpensive manner using the right shifting operation described in logic diagram 330.
[0041] Figure 4 is a flow diagram of a method 400 for vertically scaling pixel data in accordance with one embodiment of the invention. At step 410, the chrominance decimator 145 reduces the sampling rate of the blue color difference component (Cb) and the red color difference component (Cr) of the pixel data by a factor of two. In one embodiment, the chrominance decimator 145 reduces the sampling rate from a 4:4:4 sampling rate to a 4:2:2 sampling rate. In this manner, the memory requirement for storing the pixel data is reduced by one third, and thereby reducing the size requirements for line store memory 170. Although the sampling rate has been reduced by a factor of two, various embodiments of the invention contemplate that the sampling rate may be reduced by any factor.
[0042] Once the sampling rate of the blue color difference component (Cb) and the red color difference component (Cr) of the pixel data has been reduced by a factor of two, the pixel data is stored in the line store memory 170 (step 420). At step 430, the vertical sealer 146 vertically scales the pixel data that are stored in the line store memory 170. The pixel data may be vertically scaled by any vertical scaling techniques known by persons of ordinary skill in the art. For example, a new output line can be generated by interpolating between the stored previous lines using a Finite Impulse Response (FIR) interpolator. By changing the interpolated position relative to the input lines, a new image can be formed having a different number of lines than the input image.
[0043] Once the pixel data has been vertically scaled, the chrominance interpolator 147 increases the sampling rate of the blue color difference component (Cb) and the red color difference component (Cr) of the pixel data by a factor of two. In one embodiment, the chrominance decimator 147 increases the sampling rate from a 4:2:2 sampling rate to a 4:4:4 sampling rate. In this manner, the chrominance interpolator 147 restores the original sampling rate of the blue color difference component (Cb) and the red color difference component (Cr) of the pixel data. In one embodiment, method 400 may be programmable in that method 400 may be invoked only if the size of the line store memory 170 divided by the number of lines in the vertical sealer 146 is less than the line length.
[0044] Once the pixel data has been vertically scaled according to method 400, the pixel data may be converted from the YCbCr space to the RGB space. To that end, Figure 5 illustrates a flow diagram of a method 500 for converting pixel data from the YCbCr space to the RGB space in accordance with one embodiment of the invention. At step 510, a red color component (R) of the pixel data is determined using the equation: R = Y + 2Cr, (4) where Y is the luminance color component of the pixel data and Cr is the red color difference component of the pixel data. As in the steps described with reference to Figure 2, the color space coefficients used to determine the red color component (R) according to equation (4) are also an approximation of the industry standard color coefficients so that they may be put in a binary form. Since the color coefficients are in a binary form, the red color component (R) of the pixel data may be calculated using binary arithmetic and avoid the use of multiplication. In this manner, the red color component (R) of the pixel data to be determined in a more relatively inexpensive manner.
[0045] In accordance with one embodiment of the invention, the red color component (R) of the pixel data may be determined according to a logic diagram 610 illustrated in Figure 6A. Referring now to Figure 6A, the red color component (R) of the pixel data is determined by left shifting the red color difference component (Cr) of the pixel data by one bit (which is equivalent to a multiplication by two) and adding the result to the luminance color component (Y) of the pixel data. As mentioned above, since left shifting operations are free to implement, the red color component (R) of the
pixel data may be determined in a relatively inexpensive manner using the left shifting operation described in logic diagram 610.
[0046] At step 520, a green color component (G) of the pixel data is determined using the equation: G = Y - Cb - Cr, (5) where Y is the luminance color component of the pixel data, Cb is the blue color difference component of the pixel data and Cr is the red color difference component of the pixel data. As in step 510, the color space coefficients used to determine the green color component (G) according to equation (5) are also an approximation of the industry standard color coefficients so that they may be put in a binary form. Since the color coefficients are in a binary form, the green color component (G) of the pixel data may be calculated using binary arithmetic and avoid the use of multiplication. In this manner, the green color component (G) of the pixel data to be determined in a relatively inexpensive manner.
[0047] In accordance with one embodiment of the invention, the green color component (G) of the pixel data may be determined according to a logic diagram 620 illustrated in Figure 6B. Referring now to Figure 6B, the green color component (G) of the pixel data is determined by subtracting the blue color difference component (Cb) of the pixel data from the luminance color component Y of the pixel data and further subtracting the red color difference component Cr from the result.
[0048] At step 530, a blue color component (B) of the pixel data is determined using the equation: B = Y + 2Cb, (6) where Y is the luminance color component of the pixel data and Cb is the blue color difference component of the pixel data. As in steps 510 and 520, the color space coefficients used to determine the blue color component (B) according to equation (6) are also in a binary form. Accordingly, the blue color component (B) of the pixel data may be calculated using binary arithmetic and avoid the use of multiplication, which allows the blue color component (B) of the pixel data to be determined in a relatively inexpensive manner.
[0049] In accordance with one embodiment of the invention, the blue color component (B) of the pixel data may be determined according to a logic diagram 630
illustrated in Figure 6C. Referring now to Figure 6C, the blue color component (B) of the pixel data is determined by left shifting the blue color difference component Cr of the pixel data by one bit (which is equivalent to a multiplication by two) and adding the result to the luminance color component Y of the pixel data. As mentioned above, since left shifting operations are free to implement, the blue color component (B) of the pixel data may be determined in a relatively inexpensive manner using the left shifting operation described in logic diagram 630.
[0050] While the foregoing is directed to embodiments of the present invention, other and further embodiments of the invention may be devised without departing from the basic scope thereof, and the scope thereof is determined by the claims that follow.