DIGITAL IMAGE WARPING SYSTEM

Abstract: A system is provided for performing real-time warping in one or two dimensions (e.g. dynamic zoom and shrink in both horizontal and vertical directions), and temporal warping of image frames (e.g. fast motion and slow motion). The system accomplishes warping with proper Nyquist bandlimiting. Three different processes are performed in sequence to create the warped image according to the present invention. The first process maps a desired target pixel or frame spacing to an appropriate FIR filter wherein the size of the FIR filter is chosen based on the desired target pixel or frame spacing. Once the filter is chosen, a second process creates an appropriate number of upsampled pixels, lines or frames based on the input source pixels, lines or frames. The last process multiplies the correct filter coefficients from the first process with the interpolated pixels, lines or frames from the second process, resulting in correctly Nyquist bandlimited target pixels, lines or frames.

Description: DIGITAL IMAGE WARPING SYSTEM Field of the Invention The present invention relates in general to digital signal processing, and more particularly to an image warping system for generating an output stream of warped pixels and/or lines and/or frames from an input stream of pixels and/or lines and/or frames, respectively. Background of the Invention Digital image warping is a process of dynamically resampling a regularly spaced source image to produce a target image with different spacing than the source image. Many modern movies use digital warping to create mind boggling effects such as perspectives, odd shaped image boundaries, and texture mapping, to name but a few. Prior art real time image warping systems are extremely complicated and expensive due to the massive number of computations which must be performed in real time. Prior art systems do not dynamically bandlimit the spatial frequency of the warped image to the Nyquist limit, causing unwanted aliasing distortion. Examples of well known prior art digital image warping systems are described in the following publications and patent: I. Wolberg, George, "Separable Image Warping: Implications and Techniques", Ph.D. Thesis, Dept. of Computer Science, Columbia University, NY, 1990, and "Digital Image Warping", IEEE Computer Society Press, Los Alamitos, CA, 1990; II. U.S. Patent 5,355,328 (Arbeiter, et al) . Summary of the Invention According to the present invention, an image warping system is provided for performing real-time dynamic zoom and shrink in both horizontal and vertical directions with proper Nyquist bandlimiting, and requiring no external line stores or other memory. This same invention can also temporally warp images (eg. dynamic changes between fast motion and slow motion) by utilizing external frame stores in place of registers. Accordingly, the system of the present invention constitutes a significant advance over the known prior art. Three different processes are performed in sequence to create the warped image according to the present invention. The first process maps a desired target pixel (or line or frame) spacing to an appropriate FIR filter wherein the size of the FIR filter is chosen based on the desired target pixel (or line or frame) spacing. Once the filter is chosen, a second process creates an appropriate number of upsampled pixels (or lines or frames) based on the input source pixels (or lines or frames) . The last process multiplies the correct filter coefficients from the first process with the interpolated pixels (or lines or frames) from the second process, resulting in correctly Nyquist bandlimited target pixels (or lines or frames) . Thus, in accordance with one aspect of the invention, there is provided an apparatus and method for digitally warping an input stream of one of either pixels and/or lines and/or frames to produce an output stream of warped pixels and/or lines and/or frames in accordance with a user defined target increment defining the desired spacing between output pixels and/or lines and/or frames. In the case of digitally warped pixels and/or lines, the resulting image is considered to be spatially warped. In the case of digitally warped frames, the resulting set of frames is considered to be temporally warped. In a first embodiment of the invention, the system comprises a filter look-up table for mapping the target increment into a specific filter size, and a pair of registers to pipeline three successive filter sizes output from the filter look-up table for input to a pair of comparators. A first one of the comparators determines the largest filter size from the three values output by the filter look-up table and both registers, while the second comparator determines the largest filter size output from the filter look-up table and the first register. The output of the first comparator is received by an upsample increment generator which maps the filter size to a filter factor and then right-shifts the target increment by this amount to generate an upsample increment. The upsample increment is received by an interpolator which in response generates an appropriate number of evenly spaced upsampled pixel values. The output from the second comparator is stored in a pipeline comprising two further registers connected respectively to left and right half kernel filter generators. The left and right half kernel filter generators receive and multiply the upsampled pixels from the interpolator by respective half kernel coefficients to create the warped output pixels. In a second embodiment of the invention, the system comprises a filter look-up table for mapping the target increment into a specific filter size, and a single register for holding the filter size from the filter look-up table for input into left and right half kernel filter generators. The output of the filter look-up table is received by an upsample increment generator which maps the filter size to a filter factor and then right-shifts the target increment by this amount to generate an upsample increment. The upsample increment is received by an interpolator which in response generates an appropriate number of evenly spaced upsampled pixel values. The left and right half filter kernel generators receive and multiply the upsampled pixels from the interpolator by respective half kernel coefficients to create the warped output pixels. Each embodiment can be extended to digitally warp lines and/or frames by replacing the registers with line stores and frame stores, respectively. These larger memory storage units perform the identical function as the registers in the embodiments described in detail below. The warping technique of the present invention may be implemented utilizing the image filtering and image extension apparatus and methods described in co-pending U.S. patent application numbers 08/126,388; 08/125,530; 08/172,065; 08/124,201, all assigned to Genesis Microchip Inc. , the contents of which are incorporated herein by reference. Furthermore, the digital image warping system according to the present invention builds on technology described in U.S. Patent 5,355,328 (Arbeiter et al) , referred to above, which relates to a method of resizing source images to an arbitrary but fixed target image size. According to this prior art system, each target pixel and/or line and/or frame is resized by the same amount relative to the source pixel and/or line and/or frame. According to the present invention, each target pixel and/or line and/or frame may be individually sized arbitrarily relative to the source pixel and/or line and/or frame. More specifically, according to the present invention, source pixels and/or lines and/or frames are dynamically upsampled based on changing target pixel and/or line and/or frame resize factors. The source pixels and/or lines and/or frames are always upsampled to the nearest first octave and then decimated by fixed sized FIR filters to create Nyquist bandlimited target pixels and/or lines and/or frames. The filter sizes are dynamically determined for each target pixel and/or line and/or frame based on spatial positioning or temporal positioning as dictated by the user. Major silicon cost reduction is achieved with the present invention over prior art video warping systems through the use of fixed size FIR filters. Brief Description of the Drawings A detailed description of the preferred embodiment is provided herein below with reference to the following drawings, in which: Figure 1 shows a plurality of target pixels derived from a plurality of source pixels, wherein the target pixels are spaced according to the user defined target increment; Figure 2 is a block diagram showing functional components of the digital image warping system according to the present invention; Figure 3 shows the relative spatial positioning of source and target pixels for dynamically varying user defined target increments, and the selection of appropriate FIR filters for generating the target pixels using the system of Figure 2, according to a representative example; Figure 4 is a block diagram showing functional components of the digital image warping system according to the preferred embodiment of the present invention; and Figure 5 shows the relative spatial positioning of the source and target pixels for dynamically varying user defined target increments, and the selection of appropriate FIR filters for generating the target pixels using the preferred embodiment of Figure 4. Detailed Description of the Alternative and Preferred Embodiments In the description below, the preferred and alternative embodiments apply equally to the warping of pixels and/or lines. The same inventive principles can be used to temporally warp frames by substituting frames stores for each register in Figures 2 and 4. Furthermore, the invention is not limited to video image warping. For example, in the case of one-dimensional warping, the principles of the present invention may be applied to audio rather than video samples (eg. to correct jitter on a digital audio tape drive) . As discussed above, digital warping of an image is specified by target pixel spacing with respect to source pixel spacing. The horizontal space between each target pixel and the vertical space between each target line must be specified by the user. Likewise, the temporal spacing (ie. time) between successive frames of an image must be user specified. This detailed information provides a very fine level of control that can be used to create very complex warps. The generation of user defined target spacing is known in the art, and does not form part of the present invention. The system of the present invention receives as inputs a stream of source pixels (and/or lines and/or frames) and the desired target increment (Tarlnc) which defines the user- specified spacing. Figure 1 illustrates the generation of target pixels from source pixels based on a user defined target increment (Tarlnc) . For simplicity, the remainder of this disclosure will refer to the generation of target pixels from source pixels, it being understood that exactly the same methodology and circuitry applies to vertical processing by substituting video lines for pixels and temporal processing by substituting video frames for pixels. As can be seen from Figure 1, the first and last target pixels of a warped image are spatially aligned with the first and last source pixels. However, the spacing of the intermediate target pixels is defined by the target increment (Tarlnc) . Specifically, in the example shown in Figure 1, the first (i.e. left-most) intermediate target pixel is spaced from the first target pixel by an amount equal to 1.5 times the spacing between the source pixels, the second intermediate target pixel is spaced from the first intermediate target pixel by an amount equal to 0.75 times the spacing between the source pixels, while the last target pixel is separated from the second intermediate target pixel by an amount equal to 0.75 times the spacing between the source pixels, for a total spacing of 3.0 (i.e. the spacing between the first and last source pixels) . Turning now to Figure 2, a functional block diagram is shown according to a first embodiment of the invention for generating a stream of warped output pixels from a stream of source pixels in accordance with dynamically varying target increments. Firstly, the target increment (Tarlnc) is mapped via filter look-up table 21 to a specific FIR filter size as represented by a filter factor value based on the mapping shown in Table A, below. The FIR coefficients can be stored in a read-only table (i.e. ROM) or can be supplied by the user. Programming the coefficients gives the user the flexibility to tune the FIR filters. The filter size is chosen by indexing the filter look-up table based on Tarlnc. It is important to note that Table A is only an example of one implementation. This table could be extended to support any size of Tarlnc and generate any f ilter size and f ilter factor . Table A - FIR Filter Table and Filter Factor Once Tarlnc is mapped, the largest filter on either side of a target pixel is chosen as the filter for that pixel. Figure 3 illustrates this step. The fifth line of Figure 3 (Tarlnc ® Filter Mapping) shows the Tarlnc values from the fourth line (Target Increment) mapped to various FIR filters based on the mapping of Table A, above. This is represented schematically in Figure 3 by placing the largest filter size (i.e. number of taps) of the filter sizes appearing on each side of the target pixel inside the target pixel, indicating that it is the chosen filter for that pixel. In Figure 3, the third line (Target) shows the first target pixel being generated by a 9 Tap filter, the second target pixel being generated by a 9 Tap filter, the third target pixel being generated by a 3 Tap filter, etc. As discussed above, Tarlnc is mapped to an FIR filter size according to the mapping Table A, via filter look-up table 21, the output of which (i.e. filter factor value) is stored successively in A and B registers 22 and 23, respectively, on successive clock cycles, thereby forming a pipeline. Comparator 24 determines which of two adjacent filters on each side of a target pixel is the larger, and stores a representation on this filter (i.e. the associated filter factor) in the left register 25 connected to the output of comparator 24. The left kernel MAC 26 (i.e. multiplier accumulator) reads the filter factor value stored in left register 25 and generates half of the target pixel value using the left half of the designated filter kernel. On the next clock cycle, the right kernel MAC 27 generates the rest of the target pixel value using the right half of the filter kernel and the centre tap stored in right register 28, and sums the resulting value with the output value received from left kernel MAC 26, resulting in the warped output pixel. Before dynamic filtering can take place as discussed above in connection with comparator 24, the left and right registers 25 and 28, and left and right kernel MACs 26 and 27, the correct number of upsampled pixels must be generated. Referring again to Figure 2, the number of upsampled pixels is determined by the largest filter size stored before and after A and B registers 22 and 23. Comparator 29 determines the largest filter size (i.e. largest filter factor output from filter look-up table 21) and transmits that value to an upsample increment generator 30. The upsample increment generator 30 receives and right-shifts the Tarlnc value by a predetermined number of bits equivalent to the received filter factor to produce an upsample increment value. For the example of Figure 3, the first target increment is 2.25, resulting in a filter factor of two which corresponds to a "divide-by-four" operation (i.e. right- shift Tarlnc by two bits resulting in an upsample increment of 0.5625). The upsample increment value (i.e. right-shifted Tarlnc value) represents the correct equal spacing of upsampled pixels for application to the required size of FIR filter (e.g. 9-Tap filter for Tarlnc = 2.25) . Interpolator 31 reads the upsample increment value and interpolates upsampled pixels from the source pixels on a continuous basis and with the spacing defined by the upsample increment value, until an internal incrementor or counter value reaches Tarlnc. For the example discussed above and shown in Figure 3, four upsampled pixels are generated with the spacing of 0.5625 relative to the source pixel spacing, for application to the 9 Tap FIR filter. The interpolator 31 may be implemented as a well known linear interpolator, a quadratic interpolator as disclosed in applicant's co-pending application serial number 08/172,065, or any other suitable design of interpolator. The upsampled pixels generated by interpolator 31 are transmitted to the left and right kernel MACs 26 and 27 which contain control logic to ensure that the correct coefficient is multiplied by the correct upsampled pixel. Thus, in Figure 3, line 2 (Upsample) depicts the largest possible number of required upsampled pixels for the different sized FIR filters implemented to generate the target pixels. The FIR filters shown operating between lines 2 and 3 of Figure 3 are implemented by left and right half kernel MACs 26 and 27 which multiply the correct coefficients by the correct upsampled pixel values. The internal control logic of the left and right kernel MACs 26 and 27 ensures that predetermined ones of the upsampled pixels are skipped for correct matching of coefficients and upsampled pixels. For example, whereas the 9 Tap FIR filter utilized to generate the first intermediate target pixel utilizes all of the upsampled pixels from line 2, the adjacent 3 Tap filter utilizes only the fifth, ninth and eleventh generated upsampled pixels, and skips the sixth, seventh, eighth and tenth upsampled pixels, etc. The control logic of left and right kernel MACs 26 and 27 also generates the first target pixel on start up of the system by doubling the right half kernel values for the first target pixel, as described in our copending Application No. 08/126,388. The last target pixel is generated by doubling the left kernel values. This doubling is required to ensure that all FIR coefficients maintain unity gain. Turning now to Figure 4, a functional block diagram is shown according to the preferred embodiment for generating a stream of warped output pixels from a stream of source pixels in accordance with dynamically varying target increments. Firstly, the target increment (Tarlnc) is mapped via filter look-up table 41 to a specific FIR filter size as represented by a filter factor value based on the mapping shown in Table A, above. The FIR coefficients can be stored in a read-only table (i.e. ROM) or supplied by the user. The filter size is chosen by indexing the coefficient table based on Tarlnc. It is important to note that Table A is only an example of an implementation. This table could be extended to support any size Tarlnc and generate any Filter size and Filter factor. Once Tarlnc is mapped, the filter size is held in a register 42 and fed to the left and right kernel multiplier-accumulators 44 and 45. Figure 5 illustrates this step. The fifth line of Figure 5 (Tarlnc • Filter Mapping) shows the Tarlnc values from the fourth line (Target Increment) mapped to various FIR filters based on the mapping of Table A, above. This is represented schematically in Figure 5 by placing the size of the respective half kernel of the assymetrical filter on each side of the target pixel, indicating respective half kernels for that pixel. In Figure 5, the third line (Target) shows the first target pixel being generated by a 9 Tap filter, the second target pixel being generated by an assy etrical filter being one-half of a 9 Tap filter and one-half of a 3 Tap filter, the third target pixel being generated by a 3 Tap filter, and the fourth target pixel being generated by an assymetrical filter being one-half of a 3 Tap filter and one-half of a 5 Tap filter. As discussed above, Tarlnc is mapped to an FIR filter size according to the mapping Table A, via filter look-up table 41, the output of which (i.e. filter factor value) is stored successively in register 42. The left kernel MAC 44 (i.e. multiplier accumulator) reads the filter factor value stored in register 42 and generates half of the target pixel value and a first contribution to the center tap product value using the left half of the designated filter kernel and the center tap for the left-side half kernel. On the same clock cycle, the right kernel MAC 45 generates the other half of the target pixel value and a second contribution to the center tap product value using the right half of the filter kernel and the center tap for right-side half kernel. The right kernel MAC 45 then sums the first and second contributions to the center tap multiplication product and divides that summed value by two for obtaining an averaged center tap multiplication product, and finally sums the averaged center tap multiplication product with the left half of the target pixel value received from left kernel MAC 44 and the right half of the target pixel value, resulting in the final warped output pixel. As an alternative to summing the first and second contributions to the center tap multiplication product and dividing that summed value by two, the center tap coefficient for each half kernel may simply be halved prior to storage in the associated coefficient ROM of left and right kernel MACs 44 and 45, or via the appropriate code where the invention is implemented in software. The upsample increment generator 46 receives and right-shifts the Tarlnc value by a predetermined number of bits equivalent to the received filter factor to produce an upsample increment value. For the example of Figure 5, the first target increment is 2.25, resulting in a filter factor of two which corresponds to a "divide- by-four" operation (i.e. right-shift Tarlnc by two bits resulting in an upsample increment of 0.5625). The upsample increment value (i.e. right-shifted Tarlnc value) represents the correct equal spacing of upsampled pixels for application to the required size of FIR filter (e.g. 9-Tap filter for Tarlnc = 2.25). Interpolator 47 reads the upsample increment value and interpolates upsampled pixels from the source pixels on a continuous basis and with the spacing defined by the upsample increment value, until an internal incrementor or counter value reaches Tarlnc. For the example discussed above and shown in Figure 5, four upsampled pixels are generated with the spacing of 0.5625 relative to the source pixel spacing, for application to the 9 Tap FIR filter. The interpolator 3 may be implemented as a well known linear interpolator, a quadratic interpolator as disclosed in applicant's co-pending application serial number 08/172,065, or any other suitable design of interpolator. The upsampled pixels generated by interpolator 47 are transmitted to the left and right kernel MACs 44 and 45 which contain control logic to ensure that the correct coefficient is multiplied by the correct upsampled pixel. The FIR filters shown operating between lines 2 and 3 of Figure 5 are implemented by left and right half kernel MACs 44 and 45 which multiply the correct coefficients by the correct upsampled pixel values. The control logic of left and right kernel MACs 44 and 45 also generates the first target pixel on start up of the system by doubling the right half kernel values for the first target pixel, in the manner disclosed in Application No. 08/126,388. The last target pixel is generated by doubling the left kernel values. This doubling is required to ensure that all FIR filters maintain unity gain. Other embodiments and variations of the invention are possible. For example, according to a further alternative embodiment, the invention is implemented in software using C programming language. This alternative software embodiment is fully disclosed in Appendix "A" to this disclosure. Although the warping performed in accordance with the preferred embodiment has been described as providing proper Nyquist bandlimiting, special effect warping can also be implemented using the principles of the present invention without Nyquist bandlimiting (eg. soft focus warping) . In other words, the pre-filtering and interpolations steps can be implemented without Nyquist band-limiting. All such alternative embodiments and variations are believed to be within the sphere and scope of the claims appended hereto. APPENDIX A IJ' I I'JI Vertical and Horizontal Genesis Warping Software 1.0 3'JI A'JI This program warps an input Targa Ale in both dimensions based on two i'JI aooompanying vertical and horizontal Warp Containment Files. 6'JI I'M Program Name: WARP.CPP S-M 9J- I Author James D. E. Goel 10*// 11 jl - Initial release of the software. 12-// If you have any problems, please contact me. 13.'/ 14:// Copyright (c) 1993 Genesis Microchip Inc. 15:// 200 Town Centre Blvd., Suite 400 16:// Markham, Ontario 17* / L3R 8GJ 18:// (905) 470-2742 19:// 0:// All rights reserved 1:// 2:// Modifications: 3:// 4: / Aug. 18, 1994 - James Goel 5:// - Initial release 6:// 1 ϋ I Setup standard C definitions 8:// 9:#include <stdio.h> 0:#includc <stdlib.h> 1 ^include <math.h> 2:#include <string.h> 3:#include <assertJj> 4:#indude <afκ_h> 5:#include "image.h" 6:#include "logjch" 7: 8:// 9:// Create a number of useful type definitions 0*// 1-typedef unsigned char BYTE; 2-typedef unsigned char PIXEL; 3:typedef unsigned long ULONG; 4-typedef unsigned int UINT; 5: 6:// 7- / Thii header structure is used to define a 8_// simple binary format for reading and storing 9-// image data. 0:// l.typedef struct image bdr 2:{ 3: // 4: // Image Width and Height 5: // 6: unsigned int Width; 7: unsigned int Height; 8: // 9: // Image type 0: // There are various different Genesis define 1: // images types: 2: //0 *-* Red Pixels 3: // 1 - Green Pixels 4: // 2 - Blue Pixels 5: // 3 - Luma Pixels : // 4 - Chroma (U/V lime multiplexed) 7: // 5 - Black & White Pixels 8: // 69 int ιmage_type, 70 } Genesis Header, 71 72.// 737/ This header structure is used to provide a 747/ simple and consistent method for parsing 75 Jl command line parameters 76 // 77-typedef struct cmd_lιne_tag 78 { 79 char pchV arInc[13] / Vertical warp containment field (VTarlnc) 80 char pchHTarInc[13]7/ Horizontal warp containment field (HTarInc) 81 char pchSrc[13], // Image to be warped 82 char pchWarp[13], // Output warped image 83 ) tCmd_Lιne, 84 857/ 86 // ••••••••••••••••••••••••••••****•*••••«*«*♦•••• 877/ usage - Prints appropriate command line usage 897/ 90 void UsageO 91 { 92 // 93 // Print out the proper usage 94 // 95 pπntf( "ERROR Incorrect command line parameters W), 96 pπntf ( "Usage WARP -v [Vertical Warp Containment File] "), 97 pπntf ( "-h [Horizontal Warp Containment Fιle]\n"), 98 pππtf ( " -w [Image to be Warped] "), 99 pπntf ( "*-o [Output Warped Fιlename]\n"), 100 pπntf ( "Please do not use any wild card characters \n\n"), 101 } 1027/ 1037/ *" »••••••••••••• • >•••«•••••••»•«••••••••• • >•••»•« 1047/ Parse_Cmd - Parses the oommand line parameters 1057/ •••••••••••••••••••••••••••••••••••»••••«•*•«••• 1067/ 107 void Parse_Cmd( int argc, char *argv[], tCmd_Lιne 'psCmdJ ne) 108 { 109 CFileException* theException = new CFileException, 110 t CuιτArg-0, // Command line argument counter 111 // 112 //IF there are no arguments supplied to the main line program, THEN 113 // 114 ιf(argc -= l) 115 { 116 // 117 // Print usage information 118 // 119 UsageO, 120 THROW( theException ), 121 // 122 // END IF - file arguments 123 // 124 } 125 // 126 // WHILE reading through the command line arguments, 127 // 28 while ( -»-+CuιτArg < argc ) 29 ( 30 // 31 // IF the input switches do not use dashes (-), THEN 32 // 33 if ( argv[CurτArg][0] •= '-' ) 34 { 35 // 36 // Pπng usage information 37 // 38 UsageO, 39 THROW( theException ). 2267/ 22 . *.«».«««**«**«**««.«...•*«***••***.*..****...•*.**•*•....**********•**..* 2287/ Main program loop 229 .// 230:// 231.void main(iπt argc, char *srgv[]) 232:{ 233 // Exception object for debugging 234 CFileException* theException = new CFileException; 235 Image Srclmage; // Source image to be warped 236 Image Tar Image; // Output warped image 237 Pixel VUpPixel; // Vertical Up sampled pixel 238 Pixel VFiltPix // Vertical Filtered pixel 239 LeftKemel VLeftKemel; // Vertical Left FIR Filter Kernel MAC 240 RightKemel VRighlKernel; // Vertical Right FIR Filter Kernel MAC 241 FILE •pfVTarlnc; // File pointer to the Vertical Tarlnc 242 UINT iVTarlncWidth; // Width of the the containment file 243 UINT iVTarlncHeight; // Height of the containment file 244 UINT iTarType; // *** Reserved for future expansion **' 245 float •pVTarlncLine; // Pointer to a vertical warp Tarlnc 24 float •pVTarlncLineTπi // Copy of the previous pointer 247 tCrod Line sCmd_Line; // Holds the command line parameters 248 LOOKUP VFi-tLookup; // Maps the Vert Tarlnc to FIR filter size 249 InoGen VUpIncGen; // Object to generate a Vertical Up Sample increment size 250 Interpolate VInterpolator, // Object to generate an interpolated vertical up-sampled pixel 251 BYTE •pSroCol; // Pointer to a source image column 252 BYTE •pTarCol; // Pointer to a target image column 253 BYTE *ρTarColTmp; // Copy of the previous pointer 254 UINT i Column; // Counts the number of columns in the input image 255 UINT iCount; // Counts the number of output pixels generated 256 // 257: // Print introduction 258 // 259 • riπtf( stderr, "WmWARP FAST! Generates a warped Targa file. Aug-23-1994W); 26 fprintf ( stderr, 261 fprintf ( stderr, 262 // 263 // Parse the command line parameters 264 // Load the command line parameters into the command line 265 //structure 266 // 267 TRY 268 { 269 Parse_Cmd( argc, argv, &sCmd_Line ); 270 } 271 CATCH( CException, theException ) 272 { 273 TRACE( "Exception: Error during command parsing phase ..\n" ); 274 exrt(l); 275 } 276 END_CATCH 277; // 278 // *** • **.*««.*«**•«**«««*«« • *.*. •• ***.*««** *• «*«*****«**».««««.*« •**•».»»•«* 279 // VERTICAL WARPING ALGORITHM 280 423 // Load the Upsample Increment into the Vlnterpolator 424: // 425 VlπterpolatoriTarlnc - *pVTarIncLineTmp++; 426 Vlnteη-olator.FitlFact - VFittLookup.OutO; 427: V-nterpolalor.UpInc - VUpIncGen.Out0; 428 // 429: // Load the Filter Factor into the MACs 430 // 431 VLeftKerael FihFact - VFittLookup.OutO; 432 VRightKerneLFittFact - VFittLookup.OutO; 433 // 434: // IF the output pixel is a top edge pixel, THEN: 435 // 436: if( iCount— 0 ) 437 // 438 // Double the Left filter kernel coefficients 439: // 440 VRightKemel.Double=TRUE; 441 // 442 // ELSE IF the output pixel is a bottom edge pixel, THEN: 443 // 444 else ifl. iCouπt=iVTarIncWidth-l ) 445 // 446 // Double the Right filter kernel coefficients 447: // 448 VLeftKeτnel.Double=TRUE; 449 // 450: // ELSE if the output pixel is somewhere in the middle of the image, THEN: 451 // 452 else 453 { 454 // 455 // Do not double either Right or Left kernel 456: // 457 VLeftKemel.Double-FALSE; 458 VRigh-K-mel.Double=FALSE; 45 } 460: // 461 // END IF - output pixel is on an edge 462 // 463 // 464 // Calculate the center tap Kernel values 465 // 466: VLeftKemel.MAC( Vlntαpolatαr.UpPix ); 467: VRightKemel.MAC( Vlntetpolaior.UpPix ); 468 // 469 // LOOP through the other FIR filter taps 470; // 471 wfaile( Vlnterpolalor.CenterTapO !-** TRUE ) 472: { 473: // 474: // Generate an interpolated pixel 475; // Fitter the interpolated pixel 476 // 477 VUpPixel - Vlntetpolator.GenerateO; 478 VLeftKerne_.MAC( VUpPixel ); 479 VRightKetneI.MAC( VUpPixel ); 480: // 481 // END LOOP - other FIR filler taps 482 // 483 }; 484: // 485 // Write the Right Kernel Output Pixel to the output line store 486 // 487: VFittPix - VRightKemeI.FiherPixelO; 488: •(pTarColTmp++) - VF.hPix.Red; 489: *(pTa_ColTmp++) - VFUtPixGrn; 490 •(pTarColTmp++) - VFittPixBlu; 491 492 Check to make sure that the Target Line stays within output image range 493 494: aasert( (UINT) (pTarColTmp-pTarCol-1) < TarImage.WidthO*3 ); 495 // 496: // Transfer the Left Kernel to the Right Kernel 497 // 498 VRightKerr-el.A-xxιι__Red*-VLelUCeπ_eLA--Mi--Red; 499 VRightKeπκl.AocumGrn-*VLeftKcπ-el.A-xumGπ-; 500 VRightKcrnel.AixumBlu-V fuKcπiel.A-x-uπiBlu; 501 // 502: // END LOOP - Tarlnc values from Containment File 503 // 504: } 505 // 50 // Write Left Kernel Output Pixel to the output line store 507 // 508: VFittPix = VLeftKerneLFilterPixelO; 509 •(pTarColTmp++) -= VF.ltPix.Red; 510 •(pTarColTmp-H-) - VFihPix.Gm; 511 •(pTarColTmp-w-) = VFiltPi Blu; 512 // 513 // Check to make sure that the Target Line stays within range 514 // 515 assert( (UINT) (pTarColTmp-pTarCol-1) < Tarlmage.Width0*3 ); 516 // 517 // Write the Output Pixel line to disk 518 // 519 TRY 520; { 521 TarImage.PutColumn( pTarCol, .Colum ); 522 } 523 CATCH( CException, theExceptio ) 524: { 525 TRACER "Error while writing a warped output image line. V ); 526 fcloseallO; 527 exh(l); 528: > 529: END_CATCH 530: // 531 // END LOOP - vertical columns 532 // 533 } 534: // 535 // Save vertically warped Targa file 536: // 537 TRY 538 { 539: TarImage.Save( "verttga" ); 540 > 541 CATCH( CException, theException ) 542 { 543 TRACE( "Error while saving the vertically warped image " ); 544: fcloseallO; 545 546 } 547 END_CATCH 548 // 549 // Close the Vertical Tar Inc file 550 // 551 fclose<p_VTarInc), 552 // 553 // Print status message 554 // 555 fprintf stderr, "Finished Vertical Warping...to"); 556 fprintf stderr, "Starting Horizontal Warping... V); 557: // 558 / ........*......................*.*....*.*••........••......*.......... 559 // Horizontal WARPING ALGORITHM 560 // ......................................................*•*.....••.*.... 561 // 562 // Define all Horizontal warping variables 563 // 564 Pixel HUpPixel; // Horizontal Up sampled pixel 565: Pixel HFittPix; // Horizontal Filtered pixel 566: Image HSrcImage; // Vertically Warped Source image to be Horizontally warped 567: Image HTarlmage; // Output warped image 568: LeftKernel HLeftKe nel; // Horizontal Left FIR Filter Kernel MAC 569: RightKernel HRightKernel; // Horizontal Right FIR Fitter Kernel MAC 570: FILE * * pfHTarInc; // Pointer to Horizontal Warp Tarlnc 571: UINT iHTarlnc Width; // Width of the the containment file 572: UINT iHTarlncHeight; // Height of the containment file 573: float *pHTarIncLine; //Pointer to a specific Horizontal warp containment (Tarlnc) line 574: float *pHTarIncLineTmp; // Copy of the previous pointer 575: LOOKUP HFittLookup; //Object to map the Horizontal Tarlnc to the correct FIR filter size 576: IncGen HUpIncGen; // Object to generate a Horizontal Up Sample increment size 577: Interpolate Hlπterpolator, // Object to generate an interpolated Horizontal up-sampled pixel 578: BYTE *pSrcRow, // Pointer to a source image row 579: BYTE *pTarRow, // Pointer to a target image row 580: BYTE "pTarRowTmp; // Copy of the previous pointer 581: UINT iRow, // Counts the number of rows in the input image 582: // 583 : // Open the Horizontal Warp Containment file (Tarlnc) file 584: //IF the Tarlnc file could not be opened, THEN: 585: // 586: ifl. (pfHTarInc^open( sCmd_Line.pchHTsrInc. "Λ" )) == NULL ) 587: { 588: // 589: // Print an error message and abort 590: // 591 : fprintf stderr, "Could not open the Horizontal Warp Containment file.\n"); 592: fprintfζ stderr, "Please correct this problem and try againV); 593: exit(0); 594: // 595: //END IF 596: // 597: } 598: // 599: // Read the Width and Height ofthe Horizontal Tarlnc file 600: // 601: fτead( AiHTarlncWidth, sizeoflTJINT), 1, pfHTarlnc ); 602: fread( -S-iHTarlncHeight, sizeoflTJINT), 1, pfHTarlnc ); 603: // 604: // Read the type of Tarlnc file 605: // (Used for future expansion) 606: // 607: fi-eaάX &iTarType, sizeoflTJINT), 1, pfHTarlnc ); 608: // 609: // Allocate memory to hold one line of Horizontal Tarlnc values 610: //IF the line could not be allocated, THEN: 611: // 612: ift (pHTarlncLine - (float •)malloc<sizeof(fioat)*iHTarIncWidth)) — NULL) 613: { 614: // 615: // Print error message and abort 616: // 617: fpriπtfζ stderr, "Could not allocate memory for the Horizontal Tarlnc lineΛn"); 618: exh(l); 619: }; 620: // 621: // Open and load the Vertically warped Targa file 622: // 623: TRY 624: { 625 : HSrcImage.Load( "verttga" ); 626: } 627: CATCH( CException, theExoeption ) 628: { 629: TRACE( "Error while loading the Source ImageΛn" ); 630: fcloseallO; 631: exit(l); 632: ) 704 //Reset the Left Horizontal MAC 70 // 706: HLeftKerneLResetO; 707: // 708; // Calculate the correct Horizontal Fitterfactor based on Tarlnc 709: // 710: HFitlLookupiTarlnc « "pHTarlncLineTrnp; 711 // 712 // Load the current HTarInc into the Horizontal Upaample Increment Generator 713 // Load the correct Horizontal Fitter Factor into the Upsample Increment Generator 714: // 715 HUpIncGeafTarlnc - -"pHTarlncLineTmp; 716: HUpInoGcn.FUtFact - HFiltLookup.OutO; 717: // 718 // Load the current Tarlnc into the Hlπterpolalor 71 // Load the Filter Factor into the Hlπterpolator 720: // Load the Upaample Increment into the HInterpolator 721 // 722: HlnterpolatoriTarlnc = •pHTarIncLineTmp++; 723 Hlnterpolalor.FiltFact = HFiltLookup.OutO; 724: Hlnterpolator.UpInc - HUpIncGeaOutO; 725 // 72 // Load the Filter Factor into the MACs 727: // 728 HLeftKemel.FittFact = HFiltLookup.OutO; 729 HRightKemeLFittFact = HFiltLookup.OutO; 730 // 731 // IF the output pixel is a top edge pixel, THEN: 732 // 733 if( iCount—0 ) 734 // 735 // Double the Left filter kernel coefficients 736 // 737: HRightKemel.Double=TRUE; 738 // 739 // ELSE IF the output pixel is a bottom edge pixel, THEN: 740 // 741 else if( iCount=iHTarIncWidth-l ) 742 // 743 // Double the Right fitter kernel coefficients 744 // 745 HLeftKsrnel.E>ouble=TRUE; 746: // 747 // ELSE if the output pixel is somewhere in the middle of the image, THEN: 748 // 749 else 750: { 751 // 752 // Do not double either Right or Left kernel 753 // 754 HLeflKernel.Double°FALSE; 755 HRightKemel.Double=FALSE; 75 > 757 // 758 // END IF - output pixel is on an edge 759 // 760 // 761 // Calculate the center tap Kernel values 762: // 763 HLef-Kemel.MAC( Hlnterpolator.UpPix ); 764: HRightKeπ_el.MAC( Hlnterpolator.UpPix ); 765 // 766 // OOP through the other FIR fitter taps 767 // 768 while( Hlnterpolator.CenterTapO !- TRUE ) 769: { 770: // 771 // Generate an interpolated pixel 772 // Filter the interpolated pixel 773 // 774 HUpPixel « Hlnterpolator.GenerateO; 775 HLeflKemel.MAC( HUpPixel ); 776 HRightKernel.MAC< HUpPixel ); 777; // 778 // END LOOP - other FIR filter taps 779: // 780: }; 781 // 782 // Write the Right Kernel Output Pixel to the output line store 783 // 784 HFittPix - HRightKernel.Fi-terPixelO; 785 •(pTarRow mp++) - HFiKPixRed; 786: «(pTarRowTmp++) - HFUtPixGrn; 787 *(pTarRowTmρ++) - HFihPix.Blu; 788: // 789 // Check to make sure that the Target Line stays within output image range 790: // 791 assert( (UINT) (pTarRowTmp-pTarRow-l) < HTarImage.Width0*3 ); 792 // 793 // Transfer the Left Kernel to the Right Kernel 79 // 795 HRightKernel.A_x»mRed-H fU eπιel.AocumRed; 796 HRightKeπκl.A --umGm-**HLefU eι * nel.AccuπtGrn; 797: HRightKeπwl.AccumBlu-H flKe el.AccumBlu; 798; // 799: // END LOOP - Tarlnc values from Containment File 800: // 801 } 802: // 803 // Write Left Kernel Output Pixel to the output line store 804 // 805 HFittPix - HLeftKerneLFitterPixelO; 80 *(pTarRowTmp++) = HFiltPix-Red; 807: *(pT-_rR->wTπιp++) - HFiltPixGrn; 808 *(pTarRowTmp++) - HFiltPixBlu; 809 // 810 // Check to make sure that the Target Line stays within range 811 // 812: asaert( (UINT) (pTarRowTmp-pTarRow-l) < HTarImage.W-dthO*3 ); 813 // 814 // Write the Output Pixel line to disk 815 // 816: TRY 817 { 818 HTarImage.PutLine( pTarRow, iRow ); 819: } 820 CATCH( CExeeption, theException ) 821 { 822: TRACE( "Error while writing a warped output image lineΛn" ); 823 fcloseallO; 824 exit(l), 825 } 826 END_CATCH 827: // 828 // END LOOP - horizontal lines 829: // 830; } 831 // 832 // Save warped Targa file 833 // 834: TRY 835 { 83 HTarImage.Save( tCmd_Line.pchW._rp ); 837 } 838 CATCH( CException, theException ) 839 { 840 TRACE( "Error while saving the final Warp ImageW ); 841 fcloseallO; 842 exit<l); 843 } 844 END_CATCH 845 // 17/ 27/ Image Class - Encapsulates the Leadtools Image Functions 37/ 47/ This image class greatly improves the LeadTools user iπterfanr by 57/ providing a simplified and consistent set of C++ member functions 67/ for manipulating images. 77/ 87/ Program Name: IMAGE.CPP 97/ 107/ Author James D. E. Goel 117/ 127/ - Initial release of the software. If you have any problems, please contact me. 137/ 147/ Copyright (c) 1993 Genesis Microchip Inc. 157/ 200 Town Centre Blvd., Suite 400 167/ Markham, Ontario 177/ L3R 8G5 187/ (905) 470-2742 197/ 207/ All rights reserved. 217/ 227/ Modifications: 237/ 247/ Aug. 5, 1994 - James Goel 257/ - Initial release 267/ 27:#include "image.h" 28:#include <stdlib.h> 29:#include <assαth> 30:#include <afic.h> 31: 327/ 337/ Error codes 347/ 3S:#defineNAME_SIZE 1 36:#define SAVE_ERR 2 37- define READJERR 3 38:#define MEM_ERR 4 39: 407/ 4l .j/ ................................................................................... 427/ error - Prims appropriate error message and aborts gracefully. 43 . ................................................................................... 447/ 45rvoid lmage::Em>r( int ermum ) 46:{ 47: // 48: //SWITCH ON: Associated error 49: // 50: switch(erπ-um) 51: { 52: // S3: //ON CASE: Command line parameter error 54: // 55: caaeNAME_SIZE: 56: 57: Print out a file name size error message 58: 59: fprintf ( stderr, "ERROR: One of the input file names exceeds the legal 8.3 file name sizeΛn"); 60: fprintf ( stderr, "Please reduce the size of the file name and try again, to" ); 61: // 62: // END CASE: command line 63: // 64: break; 65: // 66: //ON CASE: Leadtools could not save the output image 67: // 68: case SAVE_ERR: 69: // 70: // Print out save error message 71: // 72: fyriaaX Mderr, "ERROR: Could not save the output image file.W); 73: fprintfl; stdeιτ, "The disk may be full or corrupted. "); 74: fprintfl; stderr, "Please correct these conditions and try againΛn"); 75: // 76: // END CASE: save error 77: // 78: break; 79: // 80: //ON CASE: Could not read the input image 81: // 82: case READ ERR: 83: // 84: // Print out load error message 85: // Stop execution 86: // 87: rintfl; stderr, "ERROR: Could not read one of the the input files.to"); 88: f^tfl stdeπ * , "The cl__k may be corrupted."); 89: fprintfl; stderr, "Please correct these conditions and try againΛn"); 90: // 91: // END CASE: load error 92: // 93: break; 94: // 95 : // ON CASE: Could not allocate the required memory 96: // 97: case MEM_ERR: 98: // 99: // Print out error 100: // 101: fprintfl; derr, "ERROR: Could not allocate the required memory.to"), 102: fprintfl; stderr, "Please free up some DOS memory and try agaiitto"); 103: // 104: // END CASE: memory error 105: // 106: break; 107: // 108: // ON DEFAULT: A fatal internal error has been generated 109: // 110: default: 111: // 112: // Print out fatal internal error 113: // Stop execution 114: // 115: print-TERROR: A fatal internal error has occurred. Please call James GoelΛn"); 116: // 117: // END DEFAULT: fatal error 118: // 119: break; 120: // 121: //END SWITCH: associated error 122: // 123: } 1247/ 1257/ END ERROR 1267/ 127:} 128: 1297/ 1307/ Default Constructor 1317/ 132:Image::Image(void) 133 :{ 134: FlagAllocLine - FALSE; 135: FlagAliocCol - FALSE; 1367/ 1377/ END Default Constructor 1387/ 139:} 140: 1417/ 1427/ Default Destructor 214: if( L_I_oadTGAScreen( pcfalnput, ftlmageBitmap, OUTPUT_BITMAP, TYPE_CONV, 0, 0)!- SUCCESS ) 215: { 216: // 217: //Print error message and abort 218: // 19: Error( READ_ERR ); 220: THROW( theException ); 221: // 222: // END IF - load Targa image 223: // 224: } 225: // 226: //Copy the width and height information to the local private variables 227: // 228: iWidth - ImageBitmap. Width; 229: -Height - ImageBitmap.Height; 2307/ END - Load image file 2317/ 232:} 2337/ ••••••••••••*•••••• 2347/ Save an Image File 23 5 : // ................... 236:void Image: :Save< char "pchOutput ) 237: { 238 : CFileException theException — new CFileException; 239: // 240 : // Save Targa Image 241: //IF the image could not be saved, THEN: 242: // 243: ii( L_SaveTGABitmap( pchOutput, &ImageBitmap, 24)!*- SUCCESS ) 244: { 245: // 246: // Print error message and abort 247: // 248: Error* SAVEJERR ); 249: L_FreeBitmap( AlmageBitma ); 250: delete pLine; 251: THROW( theException ), 252: // 253: //END IF - Save Targa image 254: // 255: } 2567/ 2577/ END - Save image file 2587/ 259:} 2607/ ••••••»••••••«•••••«. 2617/ Return the Image Width 2627/ ••*•••«»«•••••••••••*»• 263-UINT lmage:.Width( void ) 264:{ 265: return( iWidth); 2667/ 2677/ END - return image width 2687/ 269:} 2707/ ***»••****•»»»***•••»*• 2717/ Return the Image Height 2727/ ••*••••••••••••••••«•• 273-UINT Image::Height( void ) 274:{ 275: return( iHeight); 2767/ 2777/ END - return image Height 2787/ 279:} 2807/ •••••••••••••••••••••••••» 2817/ Get a line from the Image 2827/ ••••••••••*•«*»«••«••**• 283:BYTE *Image::GetLine( UINT iLineNum ) 284: { CFileException "theException - new CFileException; assert* iLineNum < (UINT) ImageBitmap.Height ); // // IF a line has not been allocated, THEN: // ifl FlagAllocLine - » FALSE ) { // //Allocate the Line // pLine - new BYTE[ImageBitmap.BytesPerI_ine]; FlagAllocLine - TRUE; // // END IF - a line has been allocated // ) II //IF the origin is in the bottom left comer, THEN: // if( ImageBitmap.ViewPeπpective — BOTTOM_LEFT ) { // Adjust the row number based on the origin of the image iLineNum "= ImageBitmap.Height - iLineNum - 1; // // END IF — origin in bottom-left corner // } // // Load the allocated line with data from the image //IF the line could not be loaded, THEN: // if( L_GetBhmapRow( &ImageBitmap, pLine, iLineNum, ImageBitmap.BytesPerLine)<0) { // // Print Error and abort // Error (MEM_ERR); L_FraeBitmap( &ImagcBhmap ); delete pLine; THROW( theException ); // // END IF - line could not be loaded // } retuπ_( pLine ); 338; { 339; CFileException "theException - new CFileException; 340: assert( iLineNum < (UINT) ImageBitmap.Height ); 341 // 342 // IF the origin is in the bottom left comer, THEN: 343 // 344: if( ImageBhmap.ViewPeπρective = BOTTOM_LEFT ) 345 { 346: // Adjust the row number based on the origin of the image 347 iLineNum - ImageBitmap.Height • iLineNum - 1; 348 // 349 // END IF - origin in bottom-left comer 350: // 351 ) 352 // 353 // Put the line into the image 354 // IF the line could not be placed, THEN: 355 // 35 if( L_Pι_tBitmapRow* &ImageBitmap, plmgLine, iLineNum, ImageBitmap.BytesPerLine)<0) 357 { 358: // 359: //Print Error and abort 360 // 361 Error (MEM_ERR); 362 L_FreeBitmap( &In__ageB_tma ); 363 delete pLine; 364: THROW( theException ); 365: 366: END IF - line could not be placed 367: 368: 3697/ 3707/ END - put a line in the Image 3717/ 372:} yj 'Jt *....**...................*. 3747/ Get a column from the Image 3757/ •*•*•••••••••••••"••*•*•*•• 376:BYTE *Image::GetColumn( UINT iColNum ) 377: 378 UINT iRowNum; 37 UINT iRow, 380 BYTE pColPixel[3]; 381 BYTE "pColTmp; 382 assert* iColNum < (UINT) ImageBhmap. Width ); 383 // 384 // IF a column has not been allocated, THEN: 385 // 386 if* FlagAllocCol = FALSE ) 387; { 388 // 389: // Allocate the Column 390: // 391 printf* "Allocating a column space.Λn"); 392 pCol - new BYTE[ImageBitmap.Height*3]; 393 FlagAllocCol - TRUE; 394 // 395 // END IF - a column has been allocated 396 // 397 } 398: pColTmp - pCc.; 399 // 400: // LOOP through the number of pixels in a specific column 401 // 402 for* iRowNum-0; iRowNum < (UINT) ImageBitmap.Height; iRowNum++ ) 403 { 404 iRow - iRowNum; 40 // 406: // IF the origin is in the bottom left corner, THEN: 407: // 408: if* ImageBrtmap. ViewPeπpective — - BOTTOM_LEFT ) 409: { 410: // Adjust the row number based on the origin of the image 411 iRow - ImageBitmap.Height - 1 - iRowNum ; 412 // 413 // END IF - origin in bottom-left comer 414 // 415 ) 416 // 417: // Read RGB pixel from the specific column 418 // 419 L_GetBttmapRowCol( &ImageBitmap, pColPixel, iRow, iColNum, 3 ); 420 // 421 // Copy the ΛGB pixel to the output buffer 422 assert* pColTmp-pCol < ImageBitmap.Height*3 ); 423 "(pCo!Tmp++) - "pColPixel; 424: "(pColTtnp++) - »(pColPixel+l); 425 "(pCo!Tmp++) = "(pCθ-Pixel+2); 426: // 427: // END LOOP - number of pixels in a specific column 428: // 429: } 430: return* pCol ); 4317/ 4327/ END - get a column from the Image 4337/ 434:} 4357/ 4367/ •••••••••*••••••••"•••••*•*• 4377/ ut a column in the Image 4 3g: ............................ 4397/ 440:void Image: :PutColumn( BYTE* pCol, UINT iColNum ) 441:{ 442: UINT iRowNum; 443: UINT iRow, 444: BYTE "pColTmp; 445: BYTE "pLineTmp; 446: assert( iColNum < (UINT) ImageBitmap. Width ); 447: assert( pCol !"* NULL); 448: // 449: // Create a temporary line holder 450: // 451: pLineTmp - new BYTE[ImageBitmap.BytesPerLine]; 452: // 453 : // Copy the original column pointer 454: // 455: pColTmp - pCol; 456: // 457: // LOOP through the number of pixels in a specific column 458: // 459: for* iRowNum-O; iRowNum < (UINT) ImageBitmap.Height; iRowNum++ ) 460: { 461 : iRow » iRowNum; 462: // 463: //IF the origin is in the bottom left comer, THEN: 464: // 465: if* ImageBitmap. ViewPcrspective — BOTTOM_LEFT ) 466: { 467: // Adjust the row number based on the origin of the image 468: iRow - ImageBitmap.Height - 1 - iRowNum ; 469: // 470: //END IF - origin in bottom-left corner 471: // 472: } 473: // 474: //Copy the RGB pixel to the output buffer 475: // 476: assert* pColTmp-pCol < ImageBitmap.Height*3 ); 477: // 478: // Write the RGB pixel to the specific column 479: // 480: L_GelBitmapRow( &ImageBitmap, pLineTmp, iRow, ImageBrtmap.BytesPerLine ); 481: pLineTmp[0+iCo-Num"3] - "pCoIT_--p++; 482: pLineTmp[l+iColNum"3] - * * * pColTmp*H-; 483: pI_-neTmp[2+tColNum*3] - * - * pCo_Tmp+* ; 484: L PutBitmapRow* &ImageBitmap, pLineTmp, iRow, ImageBitmap.BytesPerLine ); 485: // 486: //NOTE : I t-Jj-pect a bug in this LeadtooU routine 487: // 488: //L_PutBitmapRowCol( &ImagcBrtmap, ColPixel, iRow, iColNum, 3 ); 489: // 490: // END LOOP - number of pixels in a specific column 491: // 492: } 493: delete pLineTmp; 4947/ 4957/ END - put a column in the Image 4967/ 497:} 17/ 2-7/ Genesis Logic Classes 1.0 37/ 47/ This set of classes implements some basic logic functions iJ' I far use in the Genesis Warping Engine software. 67/ 77/ Program Name: LOOIC.CPP 87/ 97/ uthor James D. E. Goel 107/ 117/ - Initial release of the software. If you have any problems, please contact me. 127/ 137/ Copyright (c) 1993 Genesis Microchip Inc. 147/ 200 Town Centre Blvd., Suite 400 157/ Markham, Ontario 167/ L3R 8G5 177/ (905) 470-2742 187/ 197/ All rights reserved. 207/ 217/ Modifications: 227/ 237/ Aug. 8. 1994 • James Goel 247/ - Initial release 257/ 26: 27:#include "logic.h" 28:#include <assert.h> 29:#include <stdio.h> 30:#include <afich> 317/ 327/ Create some useful type definitions 337/ 34-typedef unsigned char BYTE; 35-typedef unsigned char PIXEL; 36-typedef unsigned long ULONG; 37-typedef unsigned int UINT; 38: 39- ........................................................................... 407/ D-Flop Register Class 1;/ ........................................................................... 427/ 437/ This class simulales a logical DFLOP. 447/ 457/ ***************************************** 467/ D-Flop Clock transfers inputs to outputs 47;// ......................................... 48-void REG::Clk* void ) 49:{ 50: Out - In; 517/ 527/ END - Constructor 53:} 54: S5 .j, ........................................................................... 567/ Filler Lookup Table yη. j , ........................................................................... 587/ 597/ This class simulates the Filter Lookup table in the warping 607/ patent, (reproduced below for completeness) 617/ 627/ Tarlnc 637/ FittSize 647/ FihFactor 657/ 667/ 1. Tarlnc is the space between output Target pixels. 677/ 2. FittSize is the FIR fitter tap size 687/ 3. FihFactor is the number of right shifts required to divide the Tarlnc 697/ into an appropriate Up Sample Increment. 707/ 71 / Constructor and Destructor 727/ 73:LOOKUP::LOOKUP( void ) 74:{ 75:}; 76:LOOKUP::-LOOKUP( void ) 77:{ 78:}; 79-// 807/ Out - Outputs a fiher factor based on the Tarlnc value 817/ 82:UINT LOOKUP-Out* void ) 83:{ 84 assert* fTarlnc > 0 ); 85 // 86: // IF Tarlnc is in the first category, THEN: 87 // 88 if* (fTarlnc > 0) && (fTarlnc < ■ * * 1)) 89: // 90: // Return a Filter Factor of 0 for the 3 Tap FIR fitter 91 / II/ 92 return 0; 93 // 94: // ELSE IF Tarlnc is in the second category, THEN: 95 // 96 else if ( (fTarlnc > 1) && (fTarlnc <= 2)) 97 // 98 // Return a Fiher Factor of 1 for the 5 Tap FIR filter 99 / I/I 100 return 1; 101 // 102 // ELSE IF Tarlnc is in the third category, THEN: 103 // 104 else if ( (fTarlnc > 2) &&. (fTarlnc <•= 4)) 105 // 106: // Return a Fiher Factor of 2 for the 9 Tap FIR filter 107 // 108: 109: // 110 // ELSE IF Tarlnc is in the fourth category, THEN: 111 // 112 else if ( (fTarlnc > 4) ΛΛ (fTarlnc <- 8)) 113 // 114 //Return a Fitter Factor of 3 for the 17 Tap FIR fitter 115 / I/I 116 return 3; 117 // 118 //ELSE IF Tarlnc is in the fifth category, THEN: 119 // 120 else if* (fTarlnc > 8) && (fTarlnc <- 16)) 121 // 122 // Return a Filter Factor of 4 for the 33 Tap FIR filter 123 // 124 return 4 125 // 126 // ELSE IF Tarlnc is in the sixth category, THEN: 127: // 128 else if ( (fTarlnc > 16) && (fTarlnc <- 32)) 129: // 130: // Return a Fiher Factor of 5 for the 65 Tap FIR filter 131 / /// 132 return 5: 133 // 134 // ELSE Tarlnc does not fit into any category, THEN: 135 // 136 else 137 138 // 139 // Print internal error message 140 // 141 fprintf* atdeπ, "Fatal internal error.to"); 142 printf* "-Tarlnc..["/«]to", fTarlnc ); 143: return 5; 144: // 145: //END IF - Filter Lookup Table 146: // 147: }; 1487/ 1497/ END FUNCTION- LOOKUP::Out 1507/ 151:}; 152: 1537/ *•••••••*»«•**•*•••**»• 1547/ Three Input Comparator 1557/ •*«..«....«....«••..••• 1567/ 1577/ Compares three inputs and outputs the largeM one. 1587/ 159.UINT TRICOMP::Out( void ) 160: { 161: UINT iTemp; 162: // 163: //Output the largest of three values 164: // 165: if* A> B) 166: iTemp - A; 167: else 168: iTemp - B; 169: 170: if( iTemp > C) 171: return iTemp; 172: else 173: return C; 1747/ 1757/ END FUNCTION - TRICOMP 1767/ 177:}; 178: 1797/ •**••••••**•••••••••••• 1807/ Two Input Comparator 1817/ ....................... 1827/ 1837/ Compares two inputs and outputs the largeM one. 1847/ 185-UINT BICOMP:-Out( void ) 186: ( 187: // 188: //Output the largeM of two values 189: // 190: if( A> B ) 191: return A; 192: else 193: return B; 1947/ 1957/ END FUNCTION - BICOMP 1967/ 197:); 198: 199-// ............................. 200 / Upsample Increment Generator 201-y ............................. 2027/ 2037/ Right shifts Tarlnc by the Filter Factor supplied by the 2047/ Filter Lookup table. 2057/ 206:ULONG IncGen::θut( void ) 207: { 208: ULONG lUpInc; 209: // 210: // Convert fTarlnc to an integer value for 211: // faster and easier arthimetic calculations 212: // 213: lUpInc = (ULONG) ( fTarlnc * INDEX_PRECISION_VALUE); 214: return ( lUpInc » FiltFact ); 2157/ 2167/ END FUNCTION - Out 2177/ 218:}; 219: 2207/ ••••••••••• ♦ • 2217/ Interpolator 2227/ ••••••••••••• 2237/ 2247/ Generates Interpolated pixeb based on the size of the Fitter Factor 2257/ Generates a flag that indicates rt has come to the end of a Tarlnc 2267/ value. 2277/ 2287/ Default Constructor and Destructor 2297/ 230:Iπterpolate::_πlerpolale( void ) 231:{ 232: // 233: // Initialize private variables 234: // 235: Accum - 0L; 236: UpIncCount - 0; 237: NexlPixPos - 0L; 238: CurrPixPoβ = 0L; 2397/ 2407/ END - Interpolate: 'Constructor 2417/ 242:}; 243:Interpola-e::~IπterpoUte* void ) 244: { 245:}; 2467/ 2477/ Reset - Reset and initialize the interpolator 2487/ 284rvoid Interpolate: :Se«Src* BYTE "pLine ) 2967/ CeαterTap - Indicates when an interpolated pixel is the center tap for an 2977/ FIR filter 29877 299:BOOLEAN Interpolate::Cet__erTap* void ) 300:{ 356: SrcCurrPixRed - SrcNexlPix.Red; 357: SroCurτPix.Gτn - SrcNextPixGm; 358: SrcCurrPix.Blu - SrcNex-Pix.Blu; 359: // 360: // Load SrcNextPix - GetNewSrc*pix) 361: // 362: SrcNex.Pix.Red - •pSreLine+-+; 363: SrcNextlHx.Gm - "-pSreLine-H-; 364: SreNextPix.Blu - *pSrcLine+ * +; 365: // 366: // END IF- NextPixPos > CurrPixPos 367: // 368: }; 369: // 370 : // Calculate Interpolated pixel using linear interpolation. 371 : // UpPix - SroCurrPix + Fraction_-l*Accum) • (SrcNextPix - SrcCuπPix ) 372: // 373 : Test - GetFrac* ccum); 374: UpPixRed - (BYTE) SroCurrPix.Red + (BYTE) 375: (GetFrac*Accum)"(SrcNextPix.Red - SrcCurrPix.Red)»INDEX_PRECISION); 376: UpPixGrn - (BYTE) SrcCurτPix.Gm + (BYTE) 377: (GetFrac(Accum) , (SrcNextPixGm - SrcCurτPix.Gm)»INDEX_PRECISIθN); 378: UpPix.Blu - (BYTE) SrcCuπPixBlu + (BYTE) 379: (GetFrac(Accum)"(SrcNextPix.Blu - SrcCurrPix.Blu)»INDEX_PRECISION); 380: retura UpPix; 381-7/ 3827/ END FUNCTION - Interpolator.:θut 3837/ 384:}; 3857/ •«••»»««••««»••«»•*•*•• 3867/ Left FIR Fitter Kernel g - / ....*•*.....***•**•**** 3887/ 3897/ This claw creates the left half of an Output Pixel baaed 3907/ on the FIR filter indicated by the Fitter Factor. 3917/ 3927/ Default Constructor and Destructor 3937/ 394:LefU*-crnel::LeftKemcl* void ) 395: { 396:}; 397:LeftKenιel::~LeftKcπ_e void ) 398: { 399:}; 4007/ 4017/ Reset - Initializes the Left Kernel MAC 4027/ 403:void LeftKenιel::Raset( void ) 404: { 405: // 406: // Initialize private variables 407: // 408: DouMe-FALSE; 409: KernelPos-O; 410: AccumRedH); 411: AccumGι_ι---0; 412: AccumBlu-0; 4137/ 4147/ END - LeftKemel::Reset 4157/ 416:}; 4177/ 4187/ MAC - Filter a pixel 4197/ 420:void LeftKen_el::MAC( Pixel UpPix ) 421:{ 422: UINT iEdgeFactor - 1; 423: 424: IF the kernel is doubled, THEN: 425: 426: if* Double— TRUE ) 4597/ FilterPixel - Return a Filter Pixel 4607/ 461 -Pixel LeftKernel::FilterPixel( void ) 462: { 463: FittPix.Red « (BYTE) (AocumRed » UBYTE_MAX); 464: FatPix.Blu - (BYTE) (AccumBlu »UBYTE_MAX); 465: RltPix.Gra - (BYTE)(AocumGm >>UBYTE_MAX); 466: // 467: // Clamp the Filtered pixel if required 468: // 469: if* AocumRed < 0) 470: FiltPix.Red - (BYTE) 0; 471: ifl AccumGrn < 0) 472: FittPixGm - (BYTE) 0; 473: if* AccumBlu < 0) 474: FitlPix.Blu = (BYTE) 0; 475: 476: if* AccumRed > 65280 ) 477: FiKPixRed - (BYTE) 255; 478: ifl AccumGra > 65280 ) 479: FihPix.Gπι - (BYTE) 255; 480: if* AccumBlu > 65280 ) 481: FittPix-Blu - (BYTE) 255; 482: 483: return* FiltPix ), 4847/ 4857/ END - LeftKernel-FihcrPixcl 4867/ 487:}; 4887/ ••••••••••••••••••••••• 4897/ Right FIR Filter Kernel 4907/ •••••»*»«»••.«««••«•• 4917/ 4927/ This class creates the Right half of an Output Pixel based 4937/ on the FIR filter indicated by the Filter Factor. 4947/ 4957/ Default Constructor and Destructor 4967/ 497:RightKernel::RightKernel( void ) 5597/ FiherPixel - Return a Filter Pixel 5607/ Pixel RightKcmel::FitterPixeK void ) { // // Convert the accumulated filtered pixel to a byte // FϋtPix.Red - (BYTE) (AccumRed » UBYTE_MAX); FiltPixGm - (BYTE) (AccumGm » UBYTE~MAX); FihPix.Hu - (BYTE) (AccumBlu » UBYTE MAX); 17/ 27/ Genesis Logic Classes 1.0 37/ 47/ This set ofcUaset tmplemα_ts some basic logic functions 57/ tor use in the Genesis Warping Engine software. 67/ 77/ Program Name: LOGIC.CPP 87/ 97/ uthor James D. E. Goel 107/ 117/ - Initial release of the software. If you have any problems, please contact me. 127/ 137/ Copyright (c) 1993 Genesis Microchip Inc. 147/ 200 Town Centre Blvd., Suite 400 157/ Markham, Ontario 167/ L3R 8G5 177/ (905) 470-2742 187/ 197/ All rights reserved. 207/ 217/ Modifications: 227/ 237/ Aug. 8, 1994 - James Goel 247/ • Initial release 257/ 26: 27:#ifcdef_LOGICCLASS_H_ 28:«def_ne _LOGICCLASS_H_ 29:*eod_f 30: 31:«fndef_cpluaplus 32:#crτor Microsoft Foundation Classes require C++ compilation (use a .cpp suffix) 33:#cndif 34: 35-typedef unsigned char BYTE; 3 -typedef unsigned char PIXEL; 37-typedef unsigned long ULONG; 38.-typedef unsigned int UINT; 39: 407/ 417/ Define a Pixel structure 427/ 43-typedef struct pixd tag 44:{ 45: BYTE Red; 46: BYTE Grn; 47: BYTE Blu; 48:} Pixel; 9: 307/ 517/ Setup a boolean type with TRUE-1 and FALSE-0 527/ 53-typedef unsigned int BOOLEAN; 54:#defineTRUE l 5:#define FALSE 0 6: 77/ 87/ Define the fractional precision of Tarlnc 97/ 0:#define INDEX_PREClSION 16L // 16 fractional bhs of precision 1 :#define DMDEX_PRECISION VALUE (1 « INDEX_PRECISION) 2:#define INDEX PRECISION_MASK ((IL « INDEX_PRECISION) - IL) 3: 47/ 5 * 7/ Define the number of bits per byte 67/ 7:#define UBYTE_MAX 8 8: 9:#defme Getlnt*Value) (*ULONGX(Value) » INDEX_PRECISION)) 0:#defin GetFrmc*Value) ((Value) & INDEX_PRECISION_MASK) 1: 727/ 737/ gtn865xl FIR Filter Coefficients 747/ 75:#def-__e MAX FILTER 6 // Maximum filter type number 76:#define MAX TAPS 33 //Maximum number of filter taps (Kernal doubled) 77: 787/ 797/ Left Kernel Coefficients 807/ 81 :conM long iLeftCoeff[MAX_FILTER][MAX_TAPS] - 82:{ 83: { 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 84: {-16, 64, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 85: { -7, 3, 30, 63, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 86: { -3, -2, 1, 7, 15, 23, 31, 37, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 87: { -1. -1. -1, 0, 0, 2, 3, 5, 7, 9,11,13,15,1633,24, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 88: { 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 16, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 89:}; 907/ 917/ Right Kernel Coefficients 927/ 93:oonM long iRig__tCoefηMAX_FILTER][MAX_TAPS] - 94:{ 95: {128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 96: {80, 64, -16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), 97: {39, 63, 30, 3, -7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 98: {19, 37, 31, 23, 15, 7, 1,-2,-3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 99: {9, 24, 33, 16, 15, 13, 11, , 7, 5, 3, 2, 0, 0,-1,-1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 100: {5, 16, 9, 9, 8, 8, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 101:}; 102: lQ jl ........................................................................... 1047/ D-Flop Register Class 1057/ ***************************************************'*********************** 1067/ 1077/ This class simulates a logical DFLOP. 1087/ 109:claas EG 110:{ Ill-private: 112-public: 113: // 114: // Input and Output Register Value 115: // 116: UINT In; 117: UINT Out; 118: // 119: // Class Constructor and Destructor 120: // 121: REG* void ); 122: -REG* void ); 123: // 124: //Clock register value 125: // 126: void Clk* void ); 1277/ 1287/ END CLASS - REG 1297/ 130:}; 131: 132:// ........................................................................... 1337/ Filter Lookup Table J3 - / ........................................................................... 1357/ 1367/ This class simulates the Filter Lookup table in the warping 1377/ patent (reproduced below for completeness) 1387/ 1397/ Tarlnc CKt<=l l<t<=2 2<t<*=4 4<t<=8 8<t<=16 16<t<=32 1407/FiltSize 3 Tap 5 Tap 9 Tap 17 Tap 33 Tap 65 Tap 1417/ FihFactor 0 1 2 3 4 5 1427/ 356: void MAC* Pixel UpPix ); 357: // 358: // Return a Filtered Pixel 359: // 360: Pixel FitterPixel* void ); 3617/ 3627/ END CLASS - RigfatKernelMAC 3637/ 364:}; 17/ 27/ Image Claas - Fmιr*" — the Leadtools Image Functions 37/ 47/ This image class greatly improves the LeadTo ls user interface by 57/ providing a simplified and consistent set of C++ member functions 67/ for manipulating images. 77/ 87/ Program Name: IMAGE.CPP 97/ 107/ Author. James D. E. Goel 117/ 127/ • Initial release of the software. If you have any problems, please contact me. 137/ 147/ Copyright (c) 1993 Genesis Microchip Inc. 157/ 200 Town Centre Blvd., Suite 400 167/ Markham, Ontario 177/ L3R 8G5 187/ (905) 470-2742 197/ 207/ All rights reserved. 217/ 227/ Modification!: 237/ 247/ Aug. 5, 1994 - James Goel 257/ - Initial release 267/ 277/ Class definition 287/ 297/ 30:#define FOR_DOS 31:#include "l_too p-h- 32:#indude "l_bitmap.h" 33:#indude "l_βrrorjr 347/ 357/ Setup LEAD TOOLS for DOS definitions 367/ 37:#ifadef_IMAGECLASS H_ 38:#define_IMAGECLASS H_ 39:#endif 40: 41:#ifiιdef_cpl-isplus 42:#erτor Microsoft Foundation Classes require C++ compilation (use a .cpp sufiix) 43:#endif

Claims: I CLAIM 1. A sample sequence warping system for receiving and warping an input sequence of source samples to produce an output sequence of target samples, comprising: a) first means for receiving successive target increments representing desired target spacing between respective ones of said target samples, and in response generating successive filter factor values representing respective FIR filters having sufficient filter coefficients to generate respective ones of said target samples with said desired target spacing; b) second means for receiving said successive filter factor values and in response selecting predetermined left and right half kernels of said respective FIR filters for generating said respective ones of said target samples; c) third means for receiving said successive target increments and said successive filter factor values and in response generating a predetermined number of upsampled intermediate samples from said input sequence of source samples; and d) fourth means for applying said upsampled intermediate samples to said predetermined left and right half kernels of said respective FIR filters for generating said output sequence of target samples. 2. The sample sequence warping system of claim 1, wherein said first means comprises a filter look-up table for correlating each said target increment with a respective one of said filter factor values and sizes of said FIR filters. 3. The sample sequence warping system of claim 2, wherein said filter look-up table generates a filter factor value of 0 when said target increment is between 0 and 1. 4. The sample sequence warping system of claim 2, wherein said filter look-up table generates a filter factor value of 1 when said target increment is between 1 and 2. 5. The sample sequence warping system of claim 2, wherein said filter look-up table generates a filter factor value of 2 when said target increment is between 2 and 4. 6. The sample sequence warping system of claim 2, wherein said filter look-up table generates a filter factor value of 3 when said target increment is between 4 and 8. 7. The sample sequence warping system of claim 2, wherein said filter look-up table generates a filter factor value of 4 when said target increment is between 8 and 16. 8. The sample sequence warping system of claim 2, wherein said filter look-up table generates a filter factor value of 5 when said target increment is between 16 and 32. 9. The sample sequence warping system of claim 1, wherein said second means further comprises means for selecting said predetermined left and right half kernels of the largest one of said respective FIR filters on either side of each of said target samples. 10. The sample sequence warping system of claim 1, wherein said second means further comprises means for selecting said predetermined left and right half kernels from respective ones of said FIR filters on either side of each of said target samples. 11. The sample sequence warping system of claim 9, wherein said means for selecting said predetermined left and right half kernels further comprises: i) first register means connected to said first means, for receiving and delaying said successive filter factor values by one sample period; and ii) first comparator means connected to said first means and said first register means, for selecting the largest of two successive filter factor values output from said first means and said first register means, and in response outputing successive largest ones of two said successive filter factor values. 12. The sample sequence warping system of claim 11, wherein said third means further comprises: iii) second register means connected to said first register means for receiving and delaying said successive filter factor values by a further sample period; iv) second comparator means connected to said first means, said first register means and said second register means, for selecting the largest of three successive filter factor values output from respective ones of said first means, said first register means and said second register means, and in response outputing successive largest ones of three said successive filter factor values; v) an upsample increment generator for receiving said successive target increments and said successive largest ones of three said successive filter factor values and in response right shifting said successive target increments respectively by said successive largest ones of three said filter factor values to form successive upsample increment values; and vi) interpolator means for receiving said successive binary target increments, said successive upsample increment values and said input sequence of source samples, and in response interpolating said input sequence of source samples to produce said predetermined number of upsampled intermediate samples spaced apart by a respective one of said upsample increment values, said predetermined number being equivalent to a respective one of said target increments divided by said respective one of said upsample increment values. 13. The sample sequence warping system of claim 12, wherein said fourth means further comprises: vii) third register means connected to said second comparator means for receiving and delaying said successive largest ones of two said successive filter factor values by one sample period; viii) fourth register means connected to said third register means for receiving and delaying said successive largest ones of two said successive filter factor values by a further sample period; ix) first half digital filter kernel multiplier accumulator means connected to said third register means and said interpolator means, for receiving and multiplying a first plurality of said upsampled intermediate samples by successive ones of said filter coefficients identified by said successive largest ones of two said successive filter factor values delayed by one sample period and in response generating a first plurality of intermediate product values, summing said first plurality of intermediate product values and in response generating a succession of accumulated intermediate product values; and x) second half digital filter kernel multiplier accumulator means connected to said first half digital filter kernel multiplier accumulator means, said fourth register means and said interpolator means, for receiving and multiplying a second plurality of said successive upsampled intermediate samples by successive ones of said filter coefficients identified by said successive largest ones of two said successive filter factor values delayed by a further sample period and in response generating a second plurality of intermediate product values, summing said second plurality of intermediate product values and in response generating a further succession of accumulated intermediate product values, and summing said succession of accumulated intermediate product values and said further succession of accumulated intermediate product values to generate said output sequence of target samples. 14. The sample sequence warping system of claim 10, wherein said third means further comprises: i) an upsample increment generator for receiving said successive target increments and said successive filter factor values and in response right shifting said successive target increments respectively by said successive filter factor values to form successive upsample increment values; and ii) interpolator means for receiving said successive target increments, said successive upsample increment values and said input sequence of source samples, and in response interpolating said input sequence of source samples to produce said predetermined number of upsampled intermediate samples spaced apart by a respective one of said upsample increment values, said predetermined number being equivalent to a respective one of said target increments divided by said respective one of said upsample increment values. 15. The sample sequence warping system of claim 14, wherein said fourth means further comprises: iii) register means connected to said first means, for receiving and delaying said successive filter factor values by one sample period; iv) first half digital filter kernel multiplier accumulator means connected to said register means and said interpolator means, for receiving and multiplying a first plurality of said upsampled intermediate samples by successive ones of said filter coefficients identified by said successive filter factor values delayed by one sample period and in response generating a first plurality of intermediate product values, summing said first plurality of intermediate product values and in response generating a succession of accumulated intermediate product values; and v) second half digital filter kernel multiplier accumulator means connected to said first half digital filter kernel multiplier accumulator means, said register means and said interpolator means, for receiving and multiplying a second plurality of said successive upsampled intermediate samples by successive ones of said filter coefficients identified by said successive filter factor values delayed by said one sample period and in response generating a second plurality of intermediate product values, summing said second plurality of intermediate product values and in response generating a further succession of accumulated intermediate product values, and summing said succession of accumulated intermediate product values and said further succession of accumulated intermediate product values to generate said output sequence of target samples. 16. A sample sequence warping method for receiving and warping an input sequence of source samples to produce an output sequence of target samples, comprising the steps of: a) receiving successive target increments representing desired target spacing between respective ones of said target samples, and in response generating successive filter factor values representing respective FIR filters having sufficient filter coefficients to generate respective ones of said target samples with said desired target spacing; b) receiving said successive filter factor values and in response selecting predetermined left and right half kernels of said respective FIR filters for generating said respective ones of said target samples; c) receiving said successive target increments and said successive filter factor values and in response generating a predetermined number of upsampled intermediate samples from said input sequence of source samples; and d) applying said upsampled intermediate samples to said predetermined left and right half kernels of said respective FIR filters for generating said output sequence of target samples. 17. The sample sequence warping method of claim 16, wherein said step of receiving said successive filter factor values and in response selecting predetermined left and right half kernels of said respective FIR filters for generating said respective ones of said target samples further comprises selecting said predetermined left and right half kernels of the largest one of said respective FIR filters on either side of each of said target samples. 18. The sample sequence warping method of claim 16, wherein said step of receiving said successive filter factor values and in response selecting predetermined left and right half kernels of said respective FIR filters for generating said respective ones of said target samples further comprises selecting said predetermined left and right half kernels from respective ones of said FIR filters on either side of each of said target samples. 19. The sample sequence warping method of claim 17, wherein said step of selecting said predetermined left and right half kernels further comprises: i) receiving and delaying said successive filter factor values by one sample period; and ii) selecting the largest of two successive filter factor values and in response outputing successive largest ones of two said successive filter factor values. 20. The sample sequence warping method of claim 19, wherein said step of receiving said successive target increments and said successive filter factor values and in response generating a predetermined number of upsampled intermediate samples from said input sequence of source samples further comprises: iii) receiving and delaying said successive filter factor values by a further sample period; iv) selecting the largest of three successive filter factor values and in response outputing successive largest ones of three said successive filter factor values; v) receiving said successive target increments and said successive largest ones of three said successive filter factor values and in response right shifting said successive target increments respectively by said successive largest ones of three said filter factor values to form successive upsample increment values; and vi) receiving said successive binary target increments, said successive upsample increment values and said input sequence of source samples, and in response interpolating said input sequence of source samples to produce said predetermined number of upsampled intermediate samples spaced apart by a respective one of said upsample increment values, said predetermined number being equivalent to a respective one of said target increments divided by said respective one of said upsample increment values. 21. The sample sequence warping method of claim 20, wherein said step of applying said upsampled intermediate samples to said predetermined left and right half kernels of said respective FIR filters for generating said output sequence of target samples further comprises: vii) receiving and delaying said successive largest ones of two said successive filter factor values by one sample period; viii) receiving and delaying said successive largest ones of two said successive filter factor values by a further sample period; ix) receiving and multiplying a first plurality of said upsampled intermediate samples by successive ones of said filter coefficients identified by said successive largest ones of two said successive filter factor values delayed by one sample period and in response generating a first plurality of intermediate product values, summing said first plurality of intermediate product values and in response generating a succession of accumulated intermediate product values; and x) receiving and multiplying a second plurality of said successive upsampled intermediate samples by successive ones of said filter coefficients identified by said successive largest ones of two said successive filter factor values delayed by a further sample period and in response generating a second plurality of intermediate product values, summing said second plurality of intermediate product values and in response generating a further succession of accumulated intermediate product values, and summing said succession of accumulated intermediate product values and said further succession of accumulated intermediate product values to generate said output sequence of target samples. 22. The sample sequence warping method of claim 18, wherein said step of receiving said successive target increments and said successive filter factor values and in response generating a predetermined number of upsampled intermediate samples from said input sequence of source samples further comprises: i) receiving said successive target increments and said successive filter factor values and in response right shifting said successive target increments respectively by said successive filter factor values to form successive upsample increment values; and ii) receiving said successive target increments, said successive upsample increment values and said input sequence of source samples, and in response interpolating said input sequence of source samples to produce said predetermined number of upsampled intermediate samples spaced apart by a respective one of said upsample increment values, said predetermined number being equivalent to a respective one of said target increments divided by said respective one of said upsample increment values. 23. The sample sequence warping method of claim 22, wherein said step of applying said upsampled intermediate samples to said predetermined left and right half kernels of said respective FIR filters for generating said output sequence of target samples further comprises: iii) receiving and delaying said successive filter factor values by one sample period; iv) receiving and multiplying a first plurality of said upsampled intermediate samples by successive ones of said filter coefficients identified by said successive filter factor values delayed by one sample period and in response generating a first plurality of intermediate product values, summing said first plurality of intermediate product values and in response generating a succession of accumulated intermediate product values; and v) receiving and multiplying a second plurality of said successive upsampled intermediate samples by successive ones of said filter coefficients identified by said successive filter factor values delayed by said one sample period and in response generating a second plurality of intermediate product values, summing said second plurality of intermediate product values and in response generating a further succession of accumulated intermediate product values, and summing said succession of accumulated intermediate product values and said further succession of accumulated intermediate product values to generate said output sequence of target samples.

Inventors: BEYER ROBERT, GOEL JAMES, GREGGAIN LANCE, BEYER, ROBERT, GOEL, JAMES, GREGGAIN, LANCE
Applicants: GENESIS MICROCHIP INC, GENESIS MICROCHIP INC.
Application year: 1995
Main classification: G06T3
IPC codes: G06T3, H04N5