# Patent

## Title
Multi-purpose scaler

## Abstract

A multi-purpose scaler utilizes a vertical scaler module and a moveable horizontal scaler module to resample a video signal either vertically or horizontally according to a selected scaling ratio. The moveable horizontal scaler module resides in one of two slots within the multi-purpose scaler architecture to provide either horizontal reduction or horizontal expansion as desired. The multi-purpose scaler is arranged to scale the video using non-linear 3 zone scaling in both the vertical and horizontal direction when selected. The multipurpose scaler is arranged to provide vertical keystone correction and vertical height distortion correction when the video is presented through a projector at a non-zero tilt angle. The multi-purpose scaler is also arranged to provide interlacing and de-interlacing of the video frames as necessary.

## Background
CROSS REFERENCE TO RELATED APPLICATION
This is a division of commonly-assigned U.S. patent application Ser. No. 11/294,708, filed Dec. 5, 2005, now U.S. Pat. No. 7,941,001, which is hereby incorporated by reference herein in its entirety.


FIELD OF THE INVENTION
The present invention generally relates to signal processing applications. More particularly, the present invention is related to a circuit, system, and method for a scaler that provides both horizontal scaling and vertical scaling with additional scaler functions.
BACKGROUND
A scaler, or pixel/line sample rate converter, is a device that can resaniple a video horizontally or vertically. A scaler is an essential requirement for a digital video processor, in order to fit the incoming video to the desired display resolutions.
The ratio of input resolution to the desired output resolution is called the scaling ratio, which generates a linear mapping of the output pixel positions of the target video frame to the input pixel positions in the source video frame. Depending upon the mapping, a filter corresponding to the mapped position is picked from a bank of poly-phase filters, for generating each output pixel. Using appropriate filters during scaling for various scaling ratios ensures a clean, non-aliased and sharp output picture.
Since good quality vertical scaling operation requires more than 1 tap, scaler hardware needs to have access to either line buffers storing a few lines or a frame buffer. A set of dedicated line buffers is more economical than a frame buffer, since this also saves or decreases use of SDRAM bandwidth by a scaler when there are multiple applications accessing the SDRAM. However, there may be an associated area disadvantage of having a separate set of line buffers exclusively for a scaler. Accordingly, the designs for a particular scaler may vary greatly depending on the situations and applications to which the scaler is applied.



BRIEF DESCRIPTION OF THE DRAWINGS
Non-limiting and non-exhaustive embodiments are described with reference to the following drawings:
FIG. 1 is a schematic diagram of a multi-purpose scaler architecture with a horizontal scaler in first position;
FIG. 2 is a schematic diagram of a multi-purpose scaler architecture with a horizontal scaler in a second position;
FIG. 3 is an exemplary diagram illustrating the difference between linear and non-linear scaling as provided by the multi-purpose scaler;
FIG. 4 is a graph of an exemplary scaling ratio for a non-linear scaled image;
FIG. 5 shows an exemplary illustration of keystone distortion;
FIG. 6 shows an exemplary illustration of a keystone corrected image;
FIG. 7 illustrates de-interlacing of the lines of an image provided by the multi-purpose scaler; and
FIG. 8 illustrates interlacing of the lines of an image provided by the multi-purpose scaler, in accordance with the present disclosure.



DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT
Various embodiments of the present invention will be described in detail with reference to the drawings, where like reference numerals represent like parts and assemblies throughout the several views. Reference to various embodiments does not limit the scope of the invention, which is limited only by the scope of the claims attached hereto. Additionally, any examples set forth in this specification are not intended to be limiting and merely set forth some of the many possible embodiments for the claimed invention.
Throughout the specification and claims, the following terms take at least the meanings explicitly associated herein, unless the context clearly dictates otherwise. The meanings identified below are not intended to limit the terms, but merely provide illustrative examples for the terms. The meaning of “a,” “an,” and “the” includes plural reference, the meaning of “in” includes “in” and “on.” The term “connected” means a direct electrical connection between the items connected, without any intermediate devices. The term “coupled” means either a direct electrical connection between the items connected or an indirect connection through one or more passive or active intermediary devices. The term “circuit” means either a single component or a multiplicity of components, either active and/or passive, that are coupled together to provide a desired function. The term “signal” means at least one current, voltage, charge, temperature, data, or other signal.
Briefly stated, a multi-purpose scaler utilizes a vertical scaler module and a moveable horizontal scaler module to resample a video signal either vertically or horizontally according to a selected scaling ratio. The moveable horizontal scaler module resides in one of two slots within the multi-purpose scaler architecture to provide either horizontal reduction or horizontal expansion as desired. The multi-purpose scaler is arranged to scale the video using nonlinear 3 zone scaling in both the vertical and horizontal direction when selected. The multi-purpose scaler is arranged to provide vertical keystone correction and vertical height distortion correction when the video is presented through a projector at a non-zero tilt angle. The multi-purpose scaler is also arranged to provide interlacing and de-interlacing of the video frames as necessary. The overhead of implementing these functions in the multi-purpose scaler of the present invention is small in terms of number of gates and complexity of control logic and register programming as compared to a single function scaler. The multi-purpose scaler solution provides significant savings in die area as compared to the sum of the individual areas that would be required if each function was implemented as a separate scaling block.
FIG. 1 and FIG. 2 are schematic diagrams of a multi-purpose scaler architecture with a horizontal scaler in a first position (FIG. 1) and the horizontal scaler in a second position (FIG. 2), in accordance with the present disclosure. The multi-purpose scaler circuit is comprised of modules that include: a horizontal scaler (Hscale), a vertical scaler (Vscale), two up-samplers (UP1, UP2), a down-sampler (DWN), circular line buffer (Buff) keystone and vertical parameters calculation block/module (KVP), scaler register bank (SRB), and scaler coefficient bank (SCB).
One embodiment of the multi-purpose scaler presented herein can scale data to any scaling ratio starting from much less than one (expansion) to fifteen (reduction) in both horizontal and vertical directions. In another embodiment, the multi-purpose scaler has three scaling channels, each channel carrying a pixel, which can be used for scaling data in ROB, YCbCr, Alpha-YC (i.e., On Screen Display or OSD) or YC formats.
As the input video data (idata) is received by the multi-purpose scaler the input data (idata) forward through the first up sampler (UP1). The first up-sampler (UP1) up-samples data from 422 to 444 format. The first up-sampler (UP1) is enabled in when the horizontal scaler (Hscale) is in the first slot (before the vertical scaler (Vscale)) as depicted in FIG. 1, and data is in YC or Alpha-YC format. When the horizontal scaler (Hscale) is in the first slot, the multi-purpose scaler is arranged for horizontal reduction as is described further below. If instead, the horizontal scaler (Hscale) is in slot 2 (after the vertical scaler (Vscale)) as depicted in FIG. 2, then the first up-sampler is disabled. Once the data passes through or is processed by the first up-sampler (UP1), the data is forwarded to either the horizontal scaler (Hscale) or the circular line buffer (Buff).
When the multi-purpose scaler is configured for horizontal reduction, horizontal scaler (Hscale) receives the up-sampled data from the first up-sampler (UP1). Horizontal scaler (Hscale) scales the video horizontally. Placing the horizontal scaler (Hscale) in the first slot reduces the size of data being stored in the line buffers and therefore more lines can be stored in the circular line buffer (Buff). In the embodiment depicted by FIG. 2, the horizontal scaler (Hscale) is put in a second slot when horizontal expansion or non-linear scaling is required. In another additional embodiment (not shown), the horizontal scaler (Hscale) is removed from the scaling path when no horizontal scaling is required. Also, as described below with relation to the non-linear scaling function provided by the multi-purpose scaler, the horizontal scaler (Hscale) may calculate the variable horizontal scaling ratio for horizontal non-linear 3 zone scaling as illustrated by the associated keystone and vertical parameters calculation block (KVP).
The scaler register bank (SRB) is comprised of registers which are programmed by a host interface with the register values such as input and output resolutions, operating modes, and the like that may affect various aspects of scaling of the video signal. In one embodiment, the register bank (SRB) directly or indirectly controls all sub-modules of the scaler. In another embodiment, the registers required for each scaler module reside locally in the corresponding module (e.g., registers for vertical scaler reside in the vertical scaler (Vscale)), and a separate register bank as shown FIG. 1 and FIG. 2 is not used.
Also, the horizontal scaler (Hscale) communicates with the scaler coefficient bank (SCB). The scaler coefficient bank (SCB) is comprised of registers which contain the programmable scaling coefficients both for the vertical scaler (Vscale) and the horizontal scaler (Hscale). In an alternative embodiment, separate coefficient banks are used for the horizontal coefficients and the vertical coefficients separately.
After processing by the horizontal scaler (Hscale), the video data is processed by the down-sampler (DWN). In one embodiment, the down-sampler (DWN) is enabled in YC or Alpha-YC mode. The down-sampler (DWN) also reduces the size of pixels going into the circular line buffer (Buff) when horizontal scaler is put in the first slot as shown in FIG. 1.
Presence of the circular line buffer (Buff) makes vertical scaling and horizontal non-linear scaling possible without the presence of SDRAM before the scaler, provided the ratio of active vertical lines in the input to the active vertical lines in the output is equal to the ratio of total vertical lines in the input to the total vertical lines at the output of the scaler. Wherever this condition is not fulfilled or vertical non-linear scaling is required, presence of SDRAM is needed. In other embodiments, the circular line buffer (Buff) may be another type of buffer than that shown, or may be another type of memory circuit.
The circular line buffer (Buff) allows a variable number of lines to be stored for different line sizes and different pixel widths. With the different number of lines for different line sizes, smaller line sizes may take advantage of the maximum number of vertical scaling taps for better video quality. In most scaling scenarios, horizontal reduction is often associated with vertical reduction by a similar amount. Large vertical reduction leads to large temporary mismatches between input and output line rates which can be sustained due to availability of more space in the circular line buffer for smaller line sizes, without increasing the SDRAM bandwidth requirement. In one embodiment, the circular line buffer (Buff) comprises of a write controller, which writes data into the memory and a 1280×144 single port RAM. Having a consolidated chunk of memory is more cost effective than a memory made of distributed components and leads to more area efficiency at a minimal overhead of extra control logic. In one instance, the word size of 144 is chosen such that nine 16 bit pixels and six 24 bit pixels are packed in one memory word for the most effective memory use. In another embodiment, the circular line buffer also includes a read controller that reads data from the memory and supplies the vertical scaler (Vscale) with appropriate taps. For example, in a 16 bit mode, the maximum number of vertical taps is eight, while for a 24 bit mode, the maximum number of vertical taps is five.
Alternatively, the circular line buffer (Buff) may be used to store vertical scaling coefficients as another location for the scaler coefficient bank (SCB). The memory required is 33 extra words (64 phases, maximum 33 are stored for symmetry). Since vertical scaling coefficients change only once every line, the coefficients may be fetched once every line from the circular line buffer (Buff) during the horizontal blanking interval.
Once the vertical scaling taps are read from the circular line buffer (Buff), the taps are forward to the vertical scaler (Vscale). The vertical scaler (Vscale) scales video image vertically using the taps provided. As with the horizontal scaler (Hscale) previously described, the vertical scaler (Vscale) communicates with the keystone and vertical parameters calculation block (KW). The keystone and vertical parameters calculation block (KVP) calculates the keystone correction parameters which vary from every line and passes on the calculated values to the vertical scaler (Vscale) and the horizontal scaler (Hscale). The keystone and vertical parameters calculation block (KVP) also calculates the variable vertical scaling ratio for vertical non-linear 3 zone scaling. After the vertical scaling of the image, the video data is provided to the second up-sampler (UP2).
The vertical scaler (Vscale) also communicates with the scaler register bank (SRB) and the scaler coefficient bank (SCB) for the registry entries and the coefficients used for appropriate vertical scaling applied to the image.
The second up-sampler (UP2) up-samples data from 422 to 444 format. The second up-sampler (UP2) is enabled when horizontal scaler (Hscale) is in the second slot (after the vertical scaler (Vscale)) as depicted in FIG. 2, and the data is in YC or Alpha-YC format.
Once the vertical and horizontal scaling are complete, the scaled image is provide as video output data (odata) to other circuitry that processes the image for output to a screen, printer, or other image output device.
In one embodiment, the multi-purpose scaler is able to switch the position of the horizontal scaler (Hscale) in the path of processing the signal by using a multiplexer to selectively switch the horizontal scaler (Hscale) into position.
FIG. 3 is an exemplary diagram illustrating the difference between linear and non-linear scaling as provided by the multi-purpose scaler, in accordance with the present disclosure. The original image (300) after plain scaling results in the linearly scaled image (310). The original image (320) after horizontal non-linear scaling results in the horizontally non-linearly scaled image (320).
The scaling process can result into an output with a very different aspect ratio than that of the input. For example, a 4:3 video (640×480) may be scaled to fill 16:9 display (1920×1080). Such large changes in the aspect ratio might be undesirable while viewing video. Examining the linearly scaled image (310), the previous large circle (302) of the original image (300) has been skewed by the aspect ratio change to an oval (312). However, non-linear scaling mitigates this skewed perspective by scaling objects in the center of the image less than those towards the edge of the image as illustrated by the circle (322) in the horizontally non-linearly scaled image (320).
Through nonlinear scaling, the aspect ratio of the output frame may be preserved in at least in the desired portion of central region of the image. The corners of the horizontally non-linearly scaled image (320) are scaled non-linearly with a linearly increasing or decreasing scaling ratio, to maintain the overall scaling ratio's average. The linear change in the scaling ratio in the corner regions of the horizontally non-linearly scaled image (320) and continuity in scaling ratio through out the frame leads to a smoothly scaled picture. The picture has the aspect ratio preserved in the center and smoothly tapering towards the corner zones. In absence of a continuous gradation in the scaling ratio, movements in the corner zones of a non-linearly scaled video stand out. A continuous gradation in the scaling ratio also obviates the requirement of too many zones each associated with a different fixed scaling ratio. A continuously varying scaling ratio in one zone is equivalent or better in performance than discrete scaling ratios in 16 zones.
FIG. 4 is a graph of an exemplary scaling ratio for a non-linear scaled image, in accordance with the present disclosure. The graph illustrates the change in scaling ratio over the change in output pixels. In the graph, “ores” refers to the horizontal output resolution, “nlcres” refers to the resolution of the central region of the image where the aspect ratio is preserved (horizontal scaling ratio=vertical scaling ratio=c_ratio), “tail_ores” is the resolution of the corner regions where the image is non-linearly scaled. The horizontal scaling ratio starts with the value “init_nl_ratio” at the zeroth pixel, and increments/decrements by a constant value “inc_nl_ratio” every pixel to equal c_ratio after the tail_ores pixels. The scaling ratio remains constant for the nlcres pixels and then falls back linearly to init_nl_ratio. The init_nl_ratio and inc_nl_ratio are calculated to maintain the average horizontal scaling ratio (“avg_ratio”) over the whole of horizontal output resolution. The horizontal non-linear correction hardware receives values of nlcres, c_ratio, init_nl_ratio and inc_nl_ratio as registers calculated in software. The continuous scaling ratio is calculated from the above values in hardware itself.
Smooth vertical non-linear 3 zone scaling may also be applied to the image similarly as the horizontal non-linear 3 zone scaling described above, but in the vertical domain. The vertical scaling ratio is maintained equal to the horizontal aspect ratio in the centre, but tapers off linearly in the corner regions. The implementation of this functionality is shared with the keystone and vertical parameters calculation block (KVP) in the multi-purpose scaler hardware shown in FIG. 1 and FIG. 2.
FIG. 5 and FIG. 6 show an exemplary illustration of keystone distortion, and a keystone corrected image, in accordance with the present disclosure. The multi-purpose scaler described herein includes functionality that compensates for keystone distortion. Keystone correction is required for correcting the distortion in the projected image due to non-zero tilt angle in the projectors. This correction is done by pre-calculating the distortion, given a tilt-angle, and then applying the inverse distortion on the scaled image.
In FIG. 5, A and B represent the beam angle and the projector tilt angle respectively; tH represents the horizontal distance between the projection screen and the projector; tB and tT represent the distances of the bottom and top projected edge from the projector respectively; wB, and wT represent the lengths of the bottom and top projected edges respectively; and V represents the height of the projected image.
In one embodiment, the keystone correction hardware in the multi-purpose scaler can correct distortion for angles ranging from  ̃35°<B<35° and A<20°. More than one kind of distortion may be applicable to a keystone distorted image, including: vertical height distortion; horizontal aspect ratio distortion; and vertical scaling factor gradient distortion.
Vertical height distortion corresponds to when tilt of the projector results in a much elongated projection than the actual height of the image. The vertical height distortion results in change in aspect ratio. The increase in vertical height of the projection may be computed geometrically using the variables present in FIG. 4 so that the vertical height distortion may be corrected:
Height of the Projected image with B=0 (no tilt):




  
    
      
        
          
            
              
                V
                
                  no
                  ⁢
                  
                    -
                  
                  ⁢
                  tilt
                
              
              =
              
                Output
                ⁢
                
                  
                
                ⁢
                Y
                ⁢
                
                  
                
                ⁢
                resolution
              
            
          
        
        
          
            
              =
              
                2
                ·
                
                  t
                  H
                
                ·
                
                  tan
                  ⁡
                  
                    (
                    
                      A
                      /
                      2
                    
                    )
                  
                
              
            
          
        
      
    
    
      
        (
        
          Eq
          ⁢
          
            
          
          ⁢
          1
        
        )
      
    
  




With tilt Angle=B, height of the projection increases to:




  
    
      
        
          
            
              V
              =
              
              ⁢
              
                
                  
                    t
                    T
                  
                  ·
                  
                    sin
                    ⁡
                    
                      (
                      
                        B
                        +
                        
                          a
                          /
                          2
                        
                      
                      )
                    
                  
                
                -
                
                  
                    t
                    B
                  
                  ·
                  
                    sin
                    ⁡
                    
                      (
                      
                        B
                        -
                        
                          A
                          /
                          2
                        
                      
                      )
                    
                  
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  t
                  H
                
                ·
                
                  (
                  
                    
                      tan
                      ⁡
                      
                        (
                        
                          B
                          +
                          
                            A
                            /
                            2
                          
                        
                        )
                      
                    
                    -
                    
                      tan
                      ⁡
                      
                        (
                        
                          B
                          -
                          
                            A
                            /
                            2
                          
                        
                        )
                      
                    
                  
                  )
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  V
                  
                    no
                    ⁢
                    
                      -
                    
                    ⁢
                    tilt
                  
                
                ·
                
                  
                    (
                    
                      
                        tan
                        ⁡
                        
                          (
                          
                            B
                            +
                            
                              A
                              /
                              2
                            
                          
                          )
                        
                      
                      -
                      
                        tan
                        ⁡
                        
                          (
                          
                            B
                            -
                            
                              A
                              /
                              2
                            
                          
                          )
                        
                      
                    
                    )
                  
                  /
                  
                    (
                    
                      2
                      ·
                      
                        tan
                        ⁡
                        
                          (
                          
                            A
                            /
                            2
                          
                          )
                        
                      
                    
                    )
                  
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  
                    
                      V
                      
                        no
                        ⁢
                        
                          -
                        
                        ⁢
                        tilt
                      
                    
                    ·
                    F
                  
                  ⁢
                  
                    
                  
                  ⁢
                  where
                  ⁢
                  
                    
                  
                  ⁢
                  F
                
                =
                
                  (
                  
                    
                      tan
                      ⁡
                      
                        (
                        
                          B
                          +
                          
                            A
                            /
                            2
                          
                        
                        )
                      
                    
                    -
                  
                
              
            
          
        
        
          
            
              
                
                ⁢
                
                  tan
                  ⁢
                  
                    (
                    
                      B
                      -
                      
                        A
                        /
                        2
                      
                    
                    )
                  
                
                )
              
              /
              
                (
                
                  2
                  ·
                  
                    tan
                    ⁡
                    
                      (
                      
                        A
                        /
                        2
                      
                      )
                    
                  
                
                )
              
            
          
        
      
    
    
      
        (
        
          Eq
          ⁢
          
            
          
          ⁢
          2
        
        )
      
    
  




Factor F can be simplified to sec2B assuming A<20.
The vertical height distortion may be corrected by pre-distorting the height to effective vertical height:

Veff=Vno-tilt/F  (Eq3)

The difference is then padded with black lines at the bottom as shown in 6B of FIG. 6.
After vertical height correction, the picture of interest now lies between start and end angles. The start angle can be computed as B+A/2 and the end angle as the angle Veff output lines away from the start angle. The middle angle (shown by the dotted line in FIG. 5) is an average of start and end angles.
Horizontal aspect ratio distortion refers to trapezoidal aspect resulting from a square image being projected through a tilted projector as shown in FIG. 5. The differential horizontal widths at various vertical positions (lines) may be corrected by applying inverse geometric correction to the horizontal scaling ratio and the effective horizontal resolution so that the effects of the projection are cancelled out.
When V in FIG. 5 is Veff, then the following equations apply:




  
    
      
        
          t
          T
        
        =
        
          
            t
            H
          
          /
          
            cos
            ⁡
            
              (
              start
              )
            
          
        
      
    
    
      
        (
        
          Eq
          ⁢
          
            
          
          ⁢
          4
          ⁢
          a
        
        )
      
    
  
  
    
      
        
          t
          B
        
        =
        
          
            t
            H
          
          /
          
            cos
            ⁡
            
              (
              end
              )
            
          
        
      
    
    
      
        (
        
          Eq
          ⁢
          
            
          
          ⁢
          4
          ⁢
          b
        
        )
      
    
  








  
    
      
        
          
            
              
                W
                
                  no
                  ⁢
                  
                    -
                  
                  ⁢
                  tilt
                
              
              =
              
                Output
                ⁢
                
                  
                
                ⁢
                X
                ⁢
                
                  
                
                ⁢
                resolution
              
            
          
        
        
          
            
              =
              
                
                  Width
                  ⁢
                  
                    
                  
                  ⁢
                  of
                  ⁢
                  
                    
                  
                  ⁢
                  the
                  ⁢
                  
                    
                  
                  ⁢
                  projected
                  ⁢
                  
                    
                  
                  ⁢
                  image
                  ⁢
                  
                    
                  
                  ⁢
                  if
                  ⁢
                  
                    
                  
                  ⁢
                  B
                
                =
                
                  0
                  ⁢
                  
                    
                  
                  ⁢
                  
                    (
                    
                      no-tilt
                    
                    )
                  
                
              
            
          
        
        
          
            
              =
              
                
                  t
                  H
                
                ·
                2
                ·
                
                  tan
                  ⁡
                  
                    (
                    
                      A
                      /
                      2
                    
                    )
                  
                
              
            
          
        
      
    
    
      
        (
        
          Eq
          ⁢
          
            
          
          ⁢
          5
        
        )
      
    
  




wT=tT·2·tan(A/2)=wno-tilt/cos(start)  (Eq6a)

wB=tB·2·tan(A/2)=wno-tilt/cos(end)  (Eq6b)

Horizontal correction for width is done by pre-distorting the output resolution of each line according to

wline=wno-tilt·cos(angleline) where, start<=angleline<=end  (Eq7)

The difference is then padded with an appropriate number of black pixels on either side as shown in 6B of FIG. 6.
Vertical scaling factor gradient distortion refers to when the projection appears stretched more at top than at the bottom when the tilt is in the positive direction, or when the projection appears stretched more at bottom than at the bottom if the tilt is in the negative direction. Vertical scaling factor gradient distortion is corrected by varying the vertical scaling ratio while generating every output line, proportional to the corrected horizontal scaling ratio which also changes every line.




  
    
      
        
          H
          
            ratio
            ⁢
            
              
            
            ⁢
            no
            ⁢
            
              -
            
            ⁢
            tilt
          
        
        =
        
          
            input
            ⁢
            
              
            
            ⁢
            X
            ⁢
            
              
            
            ⁢
            resolution
          
          
            H
            
              no
              ⁢
              
                -
              
              ⁢
              tilt
            
          
        
      
    
    
      
        (
        
          Eq
          ⁢
          
            
          
          ⁢
          8
          ⁢
          a
        
        )
      
    
  
  
    
      
        
          V
          
            ratio
            ⁢
            
              
            
            ⁢
            eff
          
        
        =
        
          
            input
            ⁢
            
              
                
              
              ⁢
              
                
              
            
            ⁢
            Y
            ⁢
            
              
            
            ⁢
            resolution
          
          
            V
            eff
          
        
      
    
    
      
        (
        
          Eq
          ⁢
          
            
          
          ⁢
          8
          ⁢
          b
        
        )
      
    
  




Hratio,line=Hratio no-tilt/cos(angleline)  (Eq9a)

From Eqns 8a, 8b and 9a,

Vratio,line=Vratio eff/cos(angleline)  (Eq9b)

According to Eqns 8b and 9b, the average Veff turns out to be




  
    
      
        
          
            
              
                V
                
                  eff
                  ,
                  avg
                
              
              =
              
              ⁢
              
                (
                
                  
                    
                      V
                      eff
                    
                    ·
                    
                      cos
                      ⁡
                      
                        (
                        start
                        )
                      
                    
                  
                  +
                  
                    ...
                    ⁢
                    
                      
                    
                    ⁢
                    
                      
                        V
                        eff
                      
                      .
                      
                        cos
                        ⁡
                        
                          (
                          
                            angle
                            line
                          
                          )
                        
                      
                    
                  
                  +
                  ...
                
              
            
          
        
        
          
            
              
                
                ⁢
                
                  
                    V
                    eff
                  
                  ·
                  
                    cos
                    ⁡
                    
                      (
                      end
                      )
                    
                  
                
                )
              
              /
              
                
              
              ⁢
              
                V
                eff
              
            
          
        
        
          
            
              ≈
              
              ⁢
              
                
                  V
                  eff
                
                ·
                
                  cos
                  ⁡
                  
                    (
                    
                      
                        (
                        
                          start
                          +
                          end
                        
                        )
                      
                      /
                      2
                    
                    )
                  
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  V
                  eff
                
                ·
                
                  cos
                  ⁡
                  
                    (
                    
                      angle
                      midline
                    
                    )
                  
                
              
            
          
        
      
    
    
      
        (
        
          Eq
          ⁢
          
            
          
          ⁢
          11
        
        )
      
    
  




The plot of cosine of angles between start and end angles may be approximated as a linear curve, where A<20° and −35°<B<35°. In order to maintain the Vratio,avg as Vratio,eff and to compensate for the cosine factor in equation 11, Vratio line, as calculated in equation 9b is corrected by multiplying with the same cosine factor.




  
    
      
        
          V
          
            ratio
            ,
            
              
            
            ⁢
            line
          
        
        =
        
          
            
              V
              
                ratio
                ⁢
                
                  
                
                ⁢
                eff
              
            
            ·
            
              cos
              ⁡
              
                (
                
                  angle
                  midline
                
                )
              
            
          
          
            cos
            ⁡
            
              (
              
                angle
                line
              
              )
            
          
        
      
    
    
      
        (
        
          Eq
          ⁢
          
            
          
          ⁢
          12
        
        )
      
    
  




Using the above vertical scaling ratio per line for the image, the vertical scaling factor gradient distortion may be compensated for by the multi-purpose scaler of the present disclosure so that a corrected image is produced (e.g., 6C of FIG. 6). In one embodiment, the equations above are used to create cosine tables that correspond to the various possible angles and other coefficients for the keystone distorted image. The multi-purpose scaler is then able to use the cosine tables as fixed lookup tables for determining the keystone correction adjustments for the image in hardware rather than requiring downstream software manipulation of the image to correct for the keystone distortion. The correction for the keystone distortion therefore becomes a hardware-implemented solution provided by a provided by a hardware-implemented keystone correction module (e.g., KVP of FIG. 1 and FIG. 2) rather than a software dependent solution. In one implementation, the cosine tables do not consume more than 2000-3000 gates when synthesized at 200 MHz.
In one embodiment, for automatic keystone correction provided by the hardware, the multi-purpose scaler refers to the following registers that are programmed in the scaler register bank (SRB) shown in FIG. 1 and FIG. 2: Start-angle (start); End-angle (end); Increment angle (inc=(end−start)/(Veff−1)); and Effective output resolution (Veff). Other registers may also be used for other parameters that affect the correction of the keystone distortion using the multi-purpose scaler of the present disclosure.
FIG. 8 and FIG. 9 illustrate de-interlacing and interlacing of the lines of an image provided by the multi-purpose scaler, in accordance with the present disclosure.
Various applications of video signal processing may also take advantage of the de-interlacing and interlacing functionality provided by the multi-purpose scaler herein described. For example, when two simultaneous channels are supported in the system such as PIP (picture in picture) or PAP (picture and picture), in addition to the main picture, then, having two full-fledged de-interlacers, one for each channel is prohibitive with respect to the increase in area and consumption of memory bandwidth. A compromise is reached in case of PIP channel, by using the scaler for spatial de-interlacing instead of a full-fledged de-interlacer for PIP channel.
De-interlacing is line-doubling of video frame. By de-interlacing through the multi-purpose scaler, an advantage is gained by using more taps for vertical scaling and integrating scaling with de-interlacing, for example, from 480i to 1080p, 1080i to 480p or 480i to 240p.
The difference between scaling an interlaced input (field) to progressive output (frame) and progressive to progressive scaling is the field polarity input. Interlaced data is transmitted in top (“odd”) and bottom (“even”) fields alternatively. The lines in the bottom field are shifted down with respect to those in the top field by half an input line. While scaling the top field, the multi-purpose scaler compensates for the half-line phase-shift in the lines of the bottom field by shifting the mapping between the input and output pixels by half an input line, in the opposite direction. The shift in mapping results in the selection of different vertical scaling coefficients in the top and the bottom fields depending on the phase shift.
As shown in FIG. 7, the solid lines in the input fields (top field i1, bottom field i2) are the input lines and the dotted lines mark the spatially half-line shifted positions which match the line positions in the other field. The output frame (frame o2) generated by bottom field (i2) has the output line positions shifted up by one-half an input line with respect to those of output frame (o1) generated by top field (i1).
The multi-purpose scaler may also be used as an interlacer. Just as de-interacing is vertical up-scaling by factor of 2, interlacing is synonymous with vertical downscaling by factor of 2. However, downscaling without anti-alias pre-filtering may result in gross vertical aliases. Since the multi-purpose scaler described herein already has programmable filters and taps, interlacing may be implemented using the same logic that was used for de-interlacing with some conceptual differences.
For interlacing, the input is progressive and output is interlaced. The multi-purpose scaler generates one top and one bottom field alternatively. This differs from de-interlacing in that the half-line phase shift is introduced between the lines of top and the bottom fields. The mapping for the bottom field lines is shifted down by half an output line with respect to that for the top field lines. An addition advantage interlacing using the multi-purpose scaler is the combination of scaling and interlacing in a single circuit, such as from 480p to 1080i, 1080p to 480i or 240p to 480i.
As shown in FIG. 8, the inputs i1 and i2 are progressive frames, from which the interlaced fields (top field o1, bottom field o2) are extracted respectively. The solid lines in the output field (top field o1, bottom field o2) are the lines generated by the scaler. The dotted lines mark the spatially half-line shifted positions which match the line positions in the other field. The output field (bottom field o2) generated by the corresponding input frame (input i2) has the output line positions shifted down by one-half an output line with respect to those of the other output field (top field o1) generated by the input frame (input i1).
Implementation of all these functions described above in a single multi-purpose scaler saves area, increases reusability of the same circuit for different applications, and makes including the variety of functions provided by the multi-purpose scaler more economical.
The above specification, examples and data provide a complete description of the manufacture and use of the composition of the invention. Since many embodiments of the invention can be made without departing from the spirit and scope of the invention, the invention resides in the claims hereinafter appended.

## Claims

1. A method for processing an image, wherein processing the image occurs in accordance with a circuit, the method comprising:
linearly scaling the image in at least one of a vertical and horizontal direction when processing selected for the image is to produce a linearly scaled image from the image;
compensating for keystone distortion when keystone distortion is associated with the image;
interlacing lines of the image when processing selected for the image is to produce an interlaced image from non-interlaced data;
de-interlacing lines of the image when processing selected for the image is to produce a de-interlaced image from interlaced data; and
non-linearly scaling the image in at least one of the horizontal and the vertical direction when processing selected for the image is to produce a non-linearly scaled image from the image.

2. The method of claim 1, wherein de-interlacing lines of the image further comprises generating a first output frame from a first field, wherein the first output frame has output line positions shifted up by one-half an input line with respect to those of a second output frame generated from a second field.

3. The method of claim 1, wherein interlacing lines of the image further comprises generating a first output field from a corresponding first input frame, wherein the first output field has output line positions shifted down by one-half an output line with respect to those of a second output field generated from a second input frame.

4. The method of claim 1, wherein non-linearly scaling the image in at least one of a horizontal and vertical direction further comprises non-linearly scaling the image according to three zones, wherein a continuous gradation of a scaling ratio is applied to zones nearer to an edge of the image while a constant scaling ratio is applied to a zone corresponding to a center of the image.

5. The method of claim 1, wherein compensating for keystone distortion further comprises compensating for at least one of the following types of keystone distortion: vertical height distortion; horizontal aspect ratio distortion; and vertical scaling factor gradient distortion.

6. The method of claim 1, further comprising storing information in a scaler register bank, wherein the stored information affects at least one of the vertical and horizontal scaling of the image.

7. The method of claim 1, further comprising outputting data corresponding to the image after the data is processed.

8. The method of claim 1, wherein the compensating for keystone distortion further includes calculating a variable vertical scaling ratio for non-linear vertical scaling.

9. The method of claim 1, further comprising storing programmable coefficients, which are used for vertical and horizontal scaling, in a scaler coefficient bank.

10. The method of claim 1, further comprising temporarily storing data associated with the image in a line buffer.

11. Apparatus for processing the image, comprising:
circuitry configured to:
linearly scale the image in at least one of a vertical and horizontal direction when processing selected for the image is to produce a linearly scaled image from the image;
compensate for keystone distortion when keystone distortion is associated with the image;
interlace lines of the image when processing selected for the image is to produce an interlaced image from non-interlaced data;
de-interlace lines of the image when processing selected for the image is to produce a de-interlaced image from interlaced data; and
non-linearly scale the image in at least one of the horizontal and the vertical direction when processing selected for the image is to produce a non-linearly scaled image from the image.

12. The circuitry of claim 11, wherein the circuitry is further configured to de-interlace lines of the image by generating a first output frame from a first field, wherein the first output frame has output line positions shifted up by one-half an input line with respect to those of a second output frame generated from a second field.

13. The circuitry of claim 12, further comprising an output that is arranged to output data corresponding to the image after the data is processed.

14. The circuitry of claim 11, wherein the circuitry is further configured to interlace lines of the image by generating a first output field from a corresponding first input frame, wherein the first output field has output line positions shifted down by one-half an output line with respect to those of a second output field generated from a second input frame.

15. The circuitry of claim 11, wherein the circuitry is further configured to non-linearly scale the image in at least one of a horizontal and vertical direction by non-linearly scaling the image according to three zones, wherein a continuous gradation of a scaling ratio is applied to zones nearer to an edge of the image while a constant scaling ratio is applied to a zone corresponding to a center of the image.

16. The circuitry of claim 11, wherein the circuitry is further configured to compensate for keystone distortion by compensating for at least one of the following types of keystone distortion: vertical height distortion; horizontal aspect ratio distortion; and vertical scaling factor gradient distortion.

17. The circuitry of claim 11, further comprising a scaler register bank, wherein the scaler register bank stores information that affects at least one of the vertical and horizontal scaling of the image.

18. The circuitry of claim 11, wherein the circuitry is further configured to compensate for keystone distortion by calculating a variable vertical scaling ratio for non-linear vertical scaling.

19. The circuitry of claim 11, further comprising a scaler coefficient bank, wherein the scaler coefficient bank stores programmable coefficients which are used for vertical and horizontal scaling.

20. The circuitry of claim 11, further comprising a line buffer, wherein the line buffer temporarily stores data associated with the image.