# Patent

## Title
Video rotation in a media acceleration engine

## Abstract

The present invention provides a method and apparatus for enhancing the performance of video display devices by improving the utilization of memory resources used to process video data. In the system of the present invention, a display is configured to generate a visual image as a plurality of horizontal rows of pixels. In the present invention, the source data frame for said image is divided into row segments comprising a predetermined number of pixels from the entire horizontal row. A plurality of columns are constructed using individual pixel segments from the horizontal rows. The columns are further divided into a plurality of row segment blocks that are rotated and stored in destination memory to generate a rotated visual image.

## Background
BACKGROUND OF THE INVENTION
1. Field of the Invention
The present invention relates to video processing technology. In one aspect, the present invention relates to the display of digital video information in multiple rotated formats.
2. Description of the Related Art
Because video information requires a large amount of storage space, video information is generally compressed. Accordingly, to display compressed video information which is stored, for example on a CD-ROM or DVD, the compressed video information must be decompressed to provide decompressed video information. The decompressed video information is then provided in a bit stream to a display. The decompressed bit stream of video information is typically stored as a bit map in memory locations corresponding to pixel locations on a display. The video information required to present a single screen of information on a display is called a frame. A goal of many video systems is to quickly and efficiently decode compressed video information so as to provide motion video by displaying a sequence of frames.
Standardization of recording media, devices and various aspects of data handling, such as video compression, is highly desirable for continued growth of this technology and its applications. A number of (de)compression standards have been developed or are under development for compressing and decompressing video information, such as the Moving Pictures Expert Group (MPEG) standards for video encoding and decoding (e.g., MPEG-1, MPEG-2, MPEG-3, MPEG-4, MPEG-7, MPEG-21) or the Windows Media Video compression standards (e.g., WMV9). Each of the MPEG and WMV standards are hereby incorporated by reference in its entirety as if fully set forth herein.
In recent years, there has been a significant increase in the number of portable devices that are used to display video data using one of the standards discussed hereinabove. Many applications for the display of visual images require the ability to rotate the image. Prior art systems for rotating video images require that an entire frame of the video image be stored in a plurality of line buffers, followed by processing of the data in the line buffers to generate a rotated image.
The data processing components used in portable video devices generally present significant design constraints relating to processing capability and power management. In addition to these factors, data processing components used to process video signals present significant challenges with regard to memory management. Prior techniques discussed above for rotating a video image require large video storage buffers that occupy significant surface area on the data processing integrated circuits. It is apparent, therefore, that there is a need for an improved method and apparatus for processing video images that maximizes the use of memory resources, while decreasing the associated integrated circuit surface area devoted to video storage buffers.
SUMMARY OF THE INVENTION
The present invention provides a method and apparatus for enhancing the performance of video display devices by improving the utilization of memory resources used to process video data. In the system of the present invention, a display is configured to generate a visual image as a plurality of horizontal rows of pixels. In the present invention, the source data frame for said image is divided into row segments comprising a predetermined number of pixels from the entire horizontal row. A plurality of columns are constructed using individual pixel segments from the horizontal rows. The columns are further divided into a plurality of row segment blocks that are rotated and stored in destination memory to generate a rotated visual image.
The objects, advantages and other novel features of the present invention will be apparent to those skilled in the art from the following detailed description when read in conjunction with the appended claims and accompanying drawings.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 shows a block diagram representation of a system for processing video information.
FIG. 2 shows a block diagram representation of an exemplary video decompression system constructed in accordance with the present invention.
FIG. 3a is an illustration of a video image comprising a plurality of rows of pixels.
FIG. 3b is an illustration plurality of columns of pixel row segments used to scale a video image in accordance with the present invention.
FIG. 4a is an illustration of pixel interpolation in a row segment of a column using pixels adjacent to the interpolated pixel.
FIG. 4b is an illustration of pixel interpolation in a row segment of a column using pixels from the row segment and pixels from a row segment in adjacent columns.
FIG. 4c is an illustration of pixel interpolation in a row segment of a column using pixels from an adjacent right column and a mirrored pixel.
FIG. 4d is an illustration of pixel interpolation in a row segment of a column using pixels from an adjacent left column and a mirrored pixel.
FIG. 5 is an illustration of data processing logic used to implement the method and apparatus of the present invention for scaling a video image.
FIG. 6 is an illustration of blocks of row segments that are rotated as to generate a rotated version of a visual image.
FIGS. 7a-d are pixel matrices that illustrate the relative pixel orientations for pixels in row segment blocks at the top of a column rotated by 0 degrees, 90 degrees, 180 degrees or 270 degrees, respectively.
FIGS. 7e-h are pixel matrices that illustrate the relative pixel orientations for pixels in row segment blocks in an interior portion of a column rotated by 90 degrees, 180 degrees or 270 degrees, respectively.
FIGS. 8a-d illustrate placement of the pixels in rotated row segment frames at predetermined address locations in destination video memory.



DETAILED DESCRIPTION
While illustrative embodiments of the present invention are described below, it will be appreciated that the present invention may be practiced without the specified details, and that numerous implementation-specific decisions may be made to the invention described herein to achieve the developer's specific goals, such as compliance with system-related and business-related constraints, which will vary from one implementation to another. While such a development effort might be complex and time-consuming, it would nevertheless be a routine undertaking for those of ordinary skill in the art having the benefit of this disclosure. For example, selected aspects are shown in block diagram form, rather than in detail, in order to avoid obscuring the present invention. Such descriptions and representations are used by those skilled in the art to describe and convey the substance of their work to others skilled in the art. The present invention will now be described with reference to the drawings described below.
Referring to FIG. 1, system 100 is designed for use in mobile information appliances. System 100 includes a processor 110, a synchronous dynamic random access memory (SDRAM) controller 112, a static random access memory (SRAM) controller 114, a real time clock 116, a power management module 118, and a peripheral device control module 120, all interconnected via bus 130. The peripheral device control module 120 may be coupled to one or more peripheral devices such as an Ethernet media access control (MAC) controller, a universal serial bus (USB) device and host controller, a universal asynchronous receiver transmitter (UART) controller, an Infrared Data Association (IrDA) controller, an audio code '97 (AC'97) controller, and a secure digital (SD) controller. In various embodiments of the invention, system 100 can be implemented using a complete system on a chip (SOC) based on a MIPS32 instruction set.
System 100 also includes a media accelerator engine (MAE) 130 as well as an LCD controller 132. The media accelerator engine 130 and the display controller 132 are coupled to the SDRAM controller 112. The display controller 132 may also be coupled to a display device 134.
SDRAM controller 112 is coupled to SDRAM 140. SRAM controller 114 is coupled to a static bus 150. The static bus 150 is a general purpose bus which includes a 32-bit address path, a 32-bit data bus, a plurality of control signal paths, including a plurality of general purpose I/O signal paths. Some or all of the control signal paths and the general purpose I/O signal paths may be used depending on the type of device with which the SDRAM controller 114 is communicating. Among other possible uses, the SDRAM 140 can be used as destination video memory for storing video data in accordance with various embodiments of the invention as discussed hereinbelow.
Static bus 150 is also coupled to one or more static bus devices such as, e.g., an LCD controller 160, a personal computer memory card international association (PCMCIA) device 162, a flash memory device 164, SRAM 166, read only memory (ROM) 168, and an expansion bus 170. Static bus 150 is also coupled to a DMA acknowledge control circuit 180. The SRAM controller 114 functions as a general purpose bus controller and may communicate with any one of a plurality of static bus devices. For example, when SRAM controller 114 is communicating with the SRAM 166, then SRAM controller 114 functions as an SRAM controller. When SRAM controller 114 is communicating with a PCMCIA device 162, then the SRAM controller 114 functions as a PCMCIA controller. The static bus 150 may interface with Integrated Drive Electronics (IDE) hard drives via a modified PCMCIA interface. Such an interface eliminates the need for an external disk drive controller.
Referring to FIG. 2, a schematic block diagram of a media acceleration engine 130 is shown. The media acceleration engine 130 includes a front end 210 and a back end 212. The front end 210 includes an inverse quantize module 220, an inverse transform module 222, a reference block fetch module 223, a motion compensation module 224 and a smoothing and in-loop filter module 226. The back end 212 includes a scaling module 230, a filter module 232, and color space conversion module 234. The media acceleration engine 130 also includes a scratch pad 250 with which the smoothing and in-loop filter module 226 interacts.
The inverse quantize module 220 provides an inverse quantization (IQ) function. The inverse transform module 222 provides an inverse discrete cosine transform (IDCT) function. The motion compensation module 224 provides interframe, predicted and bidirectional motion compensation function. The motion compensation function includes support for 1, 2 and 4 motion vectors, support for field prediction and ful pel, half pel and quarter pel motion compensation. The smoothing and in-loop filter module 226 provides WMV9 an overlap smoothing and an in-loop filter function.
The color space conversion module 234 provides scaler support for various input and output modes as well as programmable coefficient data. The scaling module 230 provides a plurality of scaling functions including a reduced bandwidth operating mode. The filter module 232 enables independent horizontal and vertical filtering.
FIG. 3a is an illustration of a video frame 300 for displaying visual information on the display 134 shown in FIG. 1. The visual image is formed by a plurality of pixels P aligned in rows 302. As will be appreciated by those of skill in the art, the visual image generated by the data frame 300 is formed by reading the pixels P in the rows of the video frame. A visual image is formed by illuminating the pixels in the rows 302 using a raster scan procedure beginning in the top row from left-to-right, then proceeding to the lower rows until all pixels have been illuminated. The data for illuminating the pixels P is read from video memory in a logical pattern corresponding to the raster scan sequence used to illuminate the pixels.
Scaling of the image in FIG. 3a is typically accomplished by storing each of the individual rows 302 and performing interpolation calculations to change the number of pixels in each individual row. Scaling can be used to increase or decrease the number of pixels. Prior art scaling techniques require that the entire group of pixels in each row to be stored in a line buffer to perform the desired scaling operation. As discussed hereinabove, buffers that are large enough to store all of the pixels in the individual rows are generally undesirable in portable video data processing systems.
FIG. 3b is an illustration of an embodiment of the present invention for scaling video images by generating a plurality of row segments 303 comprising a predetermined number of the total pixels P in the individual rows 302 shown in FIG. 3a. The row segments 303 of pixels are grouped in columns 304a, 304b, . . . , 304n that can be processed efficiently to implement scaling of the video image using techniques described in greater detail hereinbelow.
FIGS. 4a-d illustrate various embodiments of the present invention for scaling a video image by interpolating pixels. Each of the interpolated pixels is obtained by using scaling logic to process information obtained from two pixels on each side of the interpolation point. FIG. 4a generally illustrates the generation of an interpolated pixel 402 within a row segment 303 in accordance with one embodiment of the invention. FIG. 4b illustrates the generation of interpolated pixels 406 and 408 for a row segment in a column that is between adjacent columns, but not on the boundary of the visual image. FIGS. 4c and 4d illustrate the generation of interpolated pixels for a row segment in a column having one side adjacent to the boundary of the visual image and the other side adjacent to another column.
Referring to FIG. 4a, the interpolated pixel 402 is obtained by using information received from two pixels on either side of the interpolation point. In the example illustrated in FIG. 4a, pixels 404a, 404b to the left and pixels 404c, 404d to the right are used to provide data for generating the interpolated pixel 402. In various embodiments of the invention discussed herein, the value for illumination of an interpolated pixel Pi, e.g. pixel 402 in FIG. 4a, is obtain by multiplying the value of the interpolation source pixels, e.g., 404a-d, by weighting coefficients according to the following formula:

Pi=A(Pn−2)+B(Pn−1)+C(Pn+1)+D(Pn+2)  [Eq1]

In the example illustrated in FIG. 4a, pixels 404a, 404b, 404c, and 404d correspond to pixels Pn−2, Pn−1, Pn+1 and Pn+2 in Eq1 above.
FIG. 4b illustrates the generation of interpolated pixels for a row segment in a column that is between adjacent columns, i.e., not on the boundary of the visual image. In this embodiment, interpolated pixels 406 and 408 are obtained by using information received from two pixels in the column and two pixels from adjacent columns. For example, interpolated pixel 406 is obtained by using data from pixels 407a and 407b from a row segment in an adjacent column and pixels 407c and 407d from within the row of the column where the interpolated pixel will be generated.
In FIG. 4c, interpolated pixel 410 is obtained by processing information received from two adjacent pixels 411c and 411d to the right of the interpolation point but within the column being processed. The two pixels to the left of interpolated pixel 410 comprise one pixel 407b that is within the column and one pixel 407a that is obtained by “mirroring” the actual pixel that is located within the column. Interpolated pixel 412 is obtained by processing information received from two pixels inside the column to the left of the interpolation point and two pixels in the adjacent column to the right of the interpolation point, as discussed above in connection with FIG. 4b. 
In FIG. 4d, interpolated pixel 414 is obtained by processing information received from two pixels inside the column to the right of the interpolation point and two pixels in the adjacent column to the left of the interpolation point as discussed above in connection with FIG. 4b. Interpolated pixel 416 is obtained by processing information received from two adjacent pixels 415a, 415b to the left of the interpolation point that are within the column being processed. The two pixels to the right of interpolated pixel 412 comprise one pixel 415c that is within the column and one pixel 415d that is obtained by “mirroring” the actual pixel that is located within the column.
The present invention also provides for vertical scaling of pixels by using pixels in adjacent row segments within a column using the techniques discussed hereinabove for horizontal scaling by interpolating pixels within a row segment. For example, interpolation of a pixel for vertical scaling can be implemented by using pixels from two rows above and two rows below the desired location for the interpolated pixel. In addition, the mirroring techniques described hereinabove can be used to provide interpolation information for generating interpolated pixels for desired pixel locations near the vertical boundaries of the video frame.
FIG. 5 is an illustration of the processing logic used to scale the visual image by processing individual pixels in a column. Incoming row segments of pixels from the source video memory are processed by a read channel DMA 500 and received in buffer 502. The row segments are sequentially provided to a shift register 504 wherein a four tap filter is implemented using taps T0, T1, T2 and T3 to generate inputs to a multiplexer 508. In addition, a horizontal scaling filter look-up table 510 provides coefficients to a multiplexer 512. The outputs of the multiplexers 508 and 512 are provided as inputs to a multiply and accumulator (MAC) 514 which processes the pixels using the coefficients from the look-up table 512. The output of the MAC 514 is provided to a FIFO buffer 518 which generates a plurality of rows that can be used as input to multiplexer 520 for vertical scaling. A vertical scaling filter look-up table 522 provides vertical scaling coefficients to a multiplexer 524 which provides coefficient inputs to MAC 526. The MAC uses the coefficients from the multiplexer 524 and the vertical rows from the multiplexer 520 to generate vertically scaled row segments for the color space converter 528. The data stream from the color space converter 528 is provided a plurality of video rotation buffers 530 that store predefined blocks, discussed in greater detail hereinbelow, for processing by rotation logic 532 to generate rotated blocks of row segments for generating a rotated visual image. The blocks of row segments are written to the destination memory by write channel DMA 534 that is operable to translate the memory addresses of pixels in the rotated row segment blocks into predetermined addresses for storage in the destination memory.
FIG. 6 is an illustration of blocks of row segments that are rotated as discussed hereinbelow to generate a rotated version of a visual image displayed in a frame 606. The frame 606 is comprised of a plurality of columns 0-n, substantially similar to those discussed hereinabove in connection with FIG. 3b. The read sequence within a single column is the same as the sequence that would be used to read the pixels in any data frame of a visual image. The reading sequence begins in the top left corner in row 0, pixel position 0 and proceeds to the right until all of the pixels in the row segment have been read. In an embodiment of the invention, a row segment comprises 32 pixels. However, after scaling of pixels, it is possible for a row to comprise up to 128 pixels. After all of the pixels in a row segment have been read, processing proceeds to the next row in the column, e.g., row 1. After all of the pixels in each of the row segments have been read, processing proceeds to the next column, e.g., column 1, and the sequence is repeated. The sequence for reading the pixels in the row segments for each of the columns is illustrated generally in FIG. 6, by dashed lines.
In various embodiments of the present invention, rotation of a visual image is accomplished by rotating a plurality of blocks comprised of a predetermined number of pixel row segments within the various columns. In one embodiment of the invention, the blocks of rows segments are symmetrical, with the number of row segments equaling the number of pixels in a single row segment. For example, in one embodiment of the invention, an individual row segment comprises 32 pixels. In this embodiment of the invention, a block of row segments would comprise 32 rows. In other embodiments of the invention, scaling of the pixels can result in up to 128 pixels in each row segment. In this embodiment of the invention, the block of row segments would comprise 128 rows.
Details relating to the blocks of row segments can be understood by referring to blocks 604 and 608 illustrated in FIG. 6. Row segment block 604 is positioned in the uppermost position in column 0, with pixels beginning at row 0, pixel position 0. The individual pixel indices within the row segment block 606 are illustrated by matrix 606. In this embodiment, the row segment block is symmetrical with n rows and n columns. Row segment block 608 is representative of a block located at an interior position within a column. The starting address for a pixel in the upper left corner of block 608 is row k, pixel 0 and the block is symmetrical with n pixel positions and k+n rows. The individual pixel indices within the row segment block 608 are illustrated by matrix 610.
As discussed above, the visual image formed by the pixels in frame 602 can be rotated by associating predetermined row segments into a plurality of row segment blocks within the columns of the frame 602 and then rotating the individual row segment blocks. In various embodiments of the invention, the individual row segment blocks can be rotated in increments of 90 degrees to rotate the individual blocks by 90 degrees, 180 degrees or 270 degrees. The pixels in the rotated row segment blocks are then stored in predetermined locations in destination memory to provide a plurality of pixels that can be used to generate a rotated visual image.
FIGS. 7a-d are pixel matrices that illustrate the relative pixel orientations for pixels in row segment block 604 rotated by 0 degrees, 90 degrees, 180 degrees or 270 degrees, respectively. Likewise, FIGS. 7e-h are pixel matrices that illustrate the relative pixel orientations for pixels in row segment block 608 rotated by 90 degrees, 180 degrees or 270 degrees, respectively.
FIGS. 8a-d illustrate placement of the pixels in rotated row segment frame 604 and 608 stored in predetermined address locations in destination video memory. FIG. 8a is an illustration of a data frame in destination video memory wherein the pixels corresponding to row segment blocks 604 and 608 have not been rotated. The row segment blocks 604 and 608 are placed in predetermined memory addresses in the destination memory for subsequent generation of a visual image that has not been rotated. FIG. 8b is an illustration of a data frame in destination video memory wherein the pixels corresponding to row segment blocks 604 and 608 have been rotated by 90 degrees and placed at predetermined memory addresses in the destination memory for subsequent generation of a visual image that has been rotated by 90 degrees. FIG. 8c is an illustration of a data frame in destination video memory wherein the pixels corresponding to row segment blocks 604 and 608 have been rotated by 180 degrees and placed at predetermined memory addresses in the destination memory for subsequent generation of a visual image that has been rotated by 180 degrees. FIG. 8d is an illustration of a data frame in destination video memory wherein the pixels corresponding to row segment blocks 604 and 608 have been rotated by 270 degrees and placed at predetermined memory addresses in the destination memory for subsequent generation of a visual image that has been rotated by 270 degrees.
In each of the aforementioned frames of destination video memory, the rotated frame segment blocks are written into predetermined addresses in a standard sequence within the segment blocks. The frame of destination memory is populated with the rotated blocks, however, in the relative sequence that the individual blocks were read from the corresponding column in the pre-rotation orientation of the video frame. For example, referring to FIG. 8b, the row segment block 802 is written into the relative location in destination video memory frame 800 in the top right corner as shown. Within the designated relative memory location, the individual pixels of the row segments are written in the conventional left-to-right sequence with the rows being read from top-to-bottom within the block. The blocks for this orientation are written in a right-to-left sequence beginning with blocks comprising the original column 0 and proceeding downward to column n. This translation of data addresses is implemented by the rotation logic 523 and write channel DMA 534 using techniques understood by those of skill in the art. Once the destination video frame has been populated, the pixels are read in a standard raster sequence from left to right within individual rows, beginning at the top row and proceeding to the bottom row.
The particular embodiments disclosed above are illustrative only and should not be taken as limitations upon the present invention, as the invention may be modified and practiced in different but equivalent manners apparent to those skilled in the art having the benefit of the teachings herein. Accordingly, the foregoing description is not intended to limit the invention to the particular form set forth, but on the contrary, is intended to cover such alternatives, modifications and equivalents as may be included within the spirit and scope of the invention as defined by the appended claims so that those skilled in the art should understand that they can make various changes, substitutions and alterations without departing from the spirit and scope of the invention in its broadest form.

## Claims

1. A method for scaling video data, comprising:
using a processor to perform the steps of:
receiving a plurality of pixels comprising a set of horizontal pixel rows for displaying a video image;
grouping predetermined sets of said plurality of pixels into row segments corresponding to portions of said horizontal pixel rows;
associating predetermined row segments to define columns of pixels corresponding to a portion of said video image;
selecting a predetermined plurality of rows to form a plurality of row segment blocks and
rotating said plurality of row segment blocks to generate a rotated video image.

2. The method of claim 1, wherein the number of rows of said row segment blocks is equal to the number of pixels in individual row segments of said columns.

3. The method of claim 2, wherein the row segments in said row segment blocks comprise interpolated pixels.

4. The method of claim 3, wherein pixels in said individual row segments are processed to provide horizontal scaling of said visual image.

5. The method of claim 4, wherein said horizontal scaling is implemented by processing said pixels in said row segments using a four tap filter.

6. The method of claim 3, wherein pixels in said individual row segments are processed to provide vertical scaling of said visual image.

7. The method of claim 6, wherein vertical scaling is implemented by processing said pixels in said row segments using a four tap filter.

8. The method of claim 3, wherein processing of said row columns to generate said scaled image comprises performing interpolation using pixels from within the row segment wherein said interpolated pixel is to be generated.

9. The method of claim 3, wherein processing of said row columns to generate said scaled image comprises performing interpolation using pixels from row segments in columns adjacent to the column of the row segment in which said interpolated pixel is to be generated.

10. The method of claim 3, wherein processing of said row columns to generate said scaled image comprises mirroring predetermined pixels in individual row segments and performing interpolation using said mirrored pixels.

11. A system for performing scaling of a video image, comprising:
video processing circuitry operable to generate a frame of video data comprising a set of horizontal pixel rows for displaying a video image;
scaling logic operable to:
group predetermined sets of said plurality of pixels into row segments corresponding to portions of said horizontal pixel rows;
associate predetermined row segments to define columns of pixels corresponding to a portion of said video image; and
select a predetermined plurality of rows to form a plurality of row segment blocks; and

video rotation logic operable to process said plurality of row segment blocks to generate a rotated video image.

12. The system of claim 11, wherein the number of rows of said row segment blocks is equal to the number of pixels in individual row segments of said columns.

13. The system of claim 12, wherein the row segments in said row segment blocks comprise interpolated pixels generated by scaling logic.

14. The system of claim 13, wherein pixels in said individual row segments are processed to provide horizontal scaling of said visual image.

15. The system of claim 14, wherein said horizontal scaling is implemented by processing said pixels in said row segments using a four tap filter.

16. The system of claim 13, wherein pixels in said individual row segments are processed to provide vertical scaling of said visual image.

17. The system of claim 16, wherein vertical scaling is implemented by processing said pixels in said row segments using a four tap filter.

18. The system of claim 13, wherein processing of said row columns to generate said scaled image comprises performing interpolation using pixels from within the row segment wherein said interpolated pixel is to be generated.

19. The system of claim 13, wherein processing of said row columns to generate said scaled image comprises performing interpolation using pixels from row segments in columns adjacent to the column of the row segment in which said interpolated pixel is to be generated.

20. The system of claim 13, wherein processing of said row columns to generate said scaled image comprises mirroring predetermined pixels in individual row segments and performing interpolation using said mirrored pixels.