The present invention will be readily understood by the following detailed description in conjunction with the accompanying drawings, wherein like reference numerals designate like structural elements.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. However, it will be apparent to those skilled in the art that the present invention may be practiced without some of these specific details. In other instances, well known process operations and implementation details have not been described in detail in order to avoid unnecessarily obscuring the invention.
The incoming Y (luminance) component first goes through either a notch filter (for composite video) or a low-pass filter (for S-video) 101. A notch filter blocks a narrow band of frequencies and passes frequencies above and below the band. It can be used to remove signals in the color subcarrier frequency ranging from the luminance data and eventually improves decoded video quality for composite video. A low-pass filter can be used to block out high-frequency components (above 6 MHz) generated as a result of 2× over-sampling, which is used for NTSC and PAL systems. The UV (chrominance or color) components first go through low-pass filters 102, 103, which minimize ringing and overshoot, and avoid the generation of visual artifacts on sharp edges. The UV components are filtered to about 1.3 MHz. Low-pass filters, 102 and 103, for chrominance components typically are Gaussian filters. The low-pass filters, 102 and 103, can also be combined into one filter.
The timing information from a timing/control generator 105 is then inserted in the filtered Y data through an adder 106. The inserted timing information allows the encoder video data to be reassembled accurately on the TV screen. Color burst information from controller 107 is added in the filtered UV data through multiplexers (MUXs) 108, 109 to provide color reference. Color burst for the chrominance data are synchronized with luminance data through connection 111. By synchronizing the color burst at the beginning of each scan line with an input clock (CLKI) 158, a television receiver is able to restore the suppressed carrier of the chrominance signals, and in turn decide the color information. In NTSC, the color burst frequency is 3.579545 MHz with a phase of 180°, whereas PAL uses a frequency of 4.43361875 MHz, with its phase alternating between 135° and 225° from line to line.
After the timing control and color burst control data are added to the YUV data, the UV data are modulated by the color subcarrier by multiplying the U components with “sine” values (U×sine) and multiplying the V components with “cosine” values (V×cosine) and added together through adder 141. The sine and cosine values of the color subcarrier are generated by an 1-stage (32-bit) Discrete Time Oscillator (DTO) 130. The DTO includes a 32-bit accumulator (ACC) 135 and sine and cosine ROMs 131, 132. The 32-bit ACC is reset every 2 frames for NTSC systems or every 4 frames for PAL systems to avoid accumulative errors. The “sine” and “cosine” values are generated by sine ROM (read only memory) 132 and cosine ROM 131, which contain sine and cosine tables. ROMs 131, 132 receive 11-bit input values for sine and cosine ROMS from a 32-bit accumulator 135 to generate accurate sine and cosine values.
The accumulator 135 receives a parameter from register 140, which can be initialized by the host at any time or can be set to default values according to TV standards during power-up. The parameter equals (fsc/fclkDto)*232, where fsc is the frequency of the color subcarrier and fclkDto is the frequency of the clock used in the DTO. fsc is 3.579545 MHz for NTSC, and 4.43361875 MHz for PAL. The accumulator 135 generates 11-bit input values with a data buffer 136, which can utilize a flip-flop or other memory cells, and an adder 137. A data buffer takes an input and conveys to the output when the clock is strobed. “Phase AdjSel” 134 comes from the “timing control generation” and is used to select certain phase shift for the subcarrier phase adjustment. The adjustment depends on TV standard and the timing. Table 1 shows the adjustment for NTSC and PAL.
The phase adjustment(s) 133 for NTSC or PAL is entered to MUX 138 along with phase AdjSel 134 to generate overall phase adjustment for the sine and cosine ROMS. MUX 138 produces the overall phase adjustment and provides it to adder 139, which also takes inputs of the 11-bit interval values, generated by accumulator 135. 11 bits of the 32-bit accumulator are used to generate accurate input values for the sine and cosine ROMs 132, 131.
Adder 139 produces overall input values for the sine and cosine ROMs 132, 131 to generate accurate sine and cosine values to modulate UV data by using multipliers 141, 142. The sine and cosine values can be represented by 9-bit values for quarters (π/2) of the sine and cosine waves and accompanying sign bits. The 9-bits values and accompanying sign bits can be used to represent the whole sine and cosine waves (2π). The modulated UV data are then added together through adder 143 to produce overall modulated chrominance data, which are provided to a data buffer 146 and to adder 144 to produce composite data with the luminance data. The data buffer 146, which can implement a flip-flop or other memory cells, allows DAC 148 one whole clock to convert the digital data to analog signal. Luminance data, composite data and a S-video or composite video selection are fed together into MUX 145 and then to data buffer 147. Similarly, the data buffer 147 allows DAC 149 one whole clock to convert the digital data to analog signal. The chrominance data and luminance data with composite data are converted into analog signals 120, 125 by DACs 148, 149 for transmission to TV decoder.
The color subcarrier is derived directly from the input clock (CLKI) 150, which is generated by a clock module, such as an oscillator, and is typically at 27 MHz for TV encoder. Any clock jitter or frequency deviation of an input clock 150 (or CLKI) will be transferred directly to the color subcarrier, which will result in hue noise on the color subcarrier. Periodic or coherent hue noise can result in differential phase error that causes noise in the decoded image. Inside a TV, typically there is a PLL module to “lock” the incoming subcarrier signal. The PLL has limited “lock” range. If the input signal is out of the range, the PLL cannot lock to the input signal. Bigger frequency deviation of CLKI can cause the TV receiver to lose the lock to the subcarrier signal and the color in the decoded image. Therefore CLKI should be very accurate and with almost no jitter.
As described above, input clock (or CLKI) for TV encoder typically run at 27 MHz. This frequency gives integer number (or full) cycles per line for both PAL and NTSC systems, and meet the requirements for DTO and TV bandwidth. The integer number cycles per line simplify circuit logic implementation. The logic circuit can easily generate accurate TV timing. However, newly developed video capturing devices, such as cell phones, do not have an input clock at 27 MHz clock. For example, cell phones have input clocks running at 26 MHz, instead of 27 MHz.
To convert digital video data, captured by a device with input clock other than 27 MHz, into standard analog baseband (NTSC/PAL) television signals, one possible solution is to add a new crystal-based 27 MHz clock on the printed circuit board (PCB) of the device. However, adding a new crystal-based 27 MHz clock increases production cost and consumes valuable space on the video-capturing device, such as a cell phone, that has limited space. Another solution is to use an on-chip phase-locked loop (PLL) to generate a 27 MHz clock from the non-27 MHz clock to encode the video. A PLL is a closed-loop feedback control system that maintains a generated signal in a fixed phase relationship to a reference signal. The PLL can convert a clock with a frequency, such as 26 MHz, into a 27 MHz clock and functions as a clock generator. However, the PLL would amplify clock jitter, which can cause severe hue noise on the decoded image.
As described above, any jitter or frequency deviation of clock will be transferred directly to the color subcarrier. Large jitter within a clock cycle interval will result in hue noise on the color subcarrier. Therefore, the clock used for the color subcarrier needs to be very accurate and with very small jitter. For consumer and industrial applications, the maximum total deviation of the clock for the color subcarrier should be limited to 50 ppm for NTSC systems or 25 ppm for PAL systems. Therefore, the clock used for the color subcarrier should not be a clock generated by a PLL, which amplifies clock jitter. The clock used for the color subcarrier should be a clock with low jitter, such as an input clock generated by a clock module (e.g. a crystal). In contrast, the clock used for the timing control and color burst control can tolerate some degree of clock jitter.
The filtered YUV data are added with timing control and color burst control generated at a clock (ClkTiming 157) different from the clock (ClkDto 156) of sine/cosine modulated color subcarrier data. The ClkTiming is at 27 MHz and is generated by a PLL 155. The 1-stage DTO 130 is driven by a ClkDto 156, which uses the input clock (CLKI 150) directly. For video-capturing devices, such as cell phones, the input clock (CLKI 150) has a clock frequency of 26 MHz. A re-sampling module 170 is added to pass the YUV data from the ClkTiming domain (27 MHz) to ClkDto domain (e.g. 26 MHz for cell phones). There are many re-sampling methods to be implemented in the re-sample module 170, such as linear interpolation, band-limited interpolation and polyphase filtering.
In
ResetA 181 and ResetB 182 of
Typically, video recorders have input clocks (CLKI) running at 27 MHz. This frequency gives integer number cycles per line for both PAL (1728 Clock cycles) and NTSC (1716 clock cycles), and meets the DTO requirement and TV bandwidth requirement. The integer number cycles per line make the logic circuit implementation relatively simple to generate accurate TV timing. However, as mentioned above, for some video-capturing devices, such as cell phones, the input clocks are not running at 27 MHz. The non-27 MHz clocks on these devices, such as 26 MHz clock for cell phones, are already available to use. Therefore, it is desirable to have an encoder utilizing the existing non-27 MHz clock. We will use 26 MHz clock for the cell phones as a non-27 MHz input clock example for the embodiment described below, however, the invention is not limited only to devices with 26 MHz clocks.
The implementation of the PAL-TV with 26 MHz clock for cell phone is more straightforward because it already has integer number (1664) clock cycles per line. But for NTSC-TV, there are about 1652.444 (actual value: 1652+4/9) clock cycles per line. If 26 MHz is used directly, the problem to implement non-integer number cycles per line needs to be solved.
The embodiment described below provides a simple way to use x MHz clock (x does not equal 27), such as 26 MHz, instead of a 27 MHz clock in a TV digital encoder. This embodiment is suitable for video capturing devices that do not have a PLL on the device to generate 27 MHz clock signals. For
These embodiments give a simple way to implement non-integer number cycles per line in a TV digital encoder. First, the encoder generates the line timing based on the integer part: 1652 cycles/Line. But at every 9th line, the clock is stopped for 4 cycles, which gives extra 4 clock cycles in 9 lines. On average there is about 1652.444 (accurately 1652 4/9) clocks per line. However TV decoder cannot tolerate sudden line length change. Therefore, a re-sampling module 490 is needed to make the change smoothly.
The filtered YUV data with timing control and color burst control are generated at the same clock as the sine/cosine modulation values. To extend the data from 1652 cycles/line to about 1652.444 (accurately 1652 4/9) cycles/line, a re-sampling module 170′ is needed.
The embodiment shown in
As described above, to ensure that the data in the 8 buffers are stable before they are used for linear interpolation, the two reset-signals, ResetA 181 and ResetB 182, are designed to have a clock gap. ResetA 181, which resets counter 175, occurs 2 or 3 clocks earlier than the ResetB, which resets the 32-bit accumulator 174 to ensure that there is data written in the deMux 171 before the data is read in MUX 173. The 3-bit counter always is 2 or 3 clocks ahead of the integer part of the 32-bit accumulator 174. The clock gap is limited by the number of buffers 172 available. In one embodiment, the clock gap is less than half of the buffer address number. For 8 buffers, the clock gap should be less than 4 (or 1 to 3). The ResetA 181 and ResetB 182 are synchronized to happen at the same line as the reset signal for the DTO. ResetA 181 and ResetB 182 occur every 4 fields for NTSC and every 8 fields for PAL. In one embodiment, all resets take place at the beginning of the vertical non-display period (VNDP) to avoid accumulative errors.
The x MHz clock shown in
The embodiments described above provide methods and devices that allow videos captured by devices, such as cell phones, to be encoded without using an additional clock module that would generate low jitter input clock frequency. The devices and methods described above either indirectly use a PLL to generate a 27 MHz clock frequency to handle the timing control and color burst control that are not sensitive to clock jitter or directly use input clock other than 27 MHz to encode videos. Encoding videos without using an additional input clock at a frequency other than 27 MHz saves power and real estate on the video capturing device. Encoding videos without using a PLL further saves power and space on the video capturing device.
Although the foregoing invention has been described in some detail for purposes of clarity of understanding, it will be apparent that certain changes and modifications may be practiced within the scope of the appended claims. Accordingly, the present embodiments are to be considered as illustrative and not restrictive, and the invention is not to be limited to the details given herein, but may be modified within the scope and equivalents of the appended claims.
This application is related to U.S. patent application Ser. No. _______ (Attorney Docket No. VP226) filed on the same day as the instant application and entitled “Methods And Devices To Use A 26 MHz Clock To Encode Videos.” The disclosure of this related application is incorporated herein by reference in its entirety for all purposes.