Method of video content complexity estimation, scene change detection and video encoding

Methods of video content complexity estimation, scene change detection and video encoding are provided. The video content complexity estimation and the scene change detecting are performed before a video encoding loop is processed. The method of video content complexity estimation includes calculating an absolute difference value diffi of the ith pixel between a current frame and a reference frame, a mean value mean(R) of pixel region R, a deviation value deviation(R) of pixel region R, a complexity value X of a target frame and an adjusted complexity Ĉtarget of the target frame by using equationsand Ĉtarget=a·X/b, respectively. Wherein, R represents N*M pixel region, a=b·SADtarget/X, b is power of 2 and SADtarget represents a true motion compensation sum of absolute difference for the target frame.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims the priority benefit of Taiwan application serial no. 94116444, filed on May 20, 2005. All disclosure of the Taiwan application is incorporated herein by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

This invention generally relates to a method of video encoding, and especially to a method of video content complexity estimation and scene change detection.

2. Description of Related Art

Digital video usually contains a huge number of data. In order to save transmission bandwidth when transmitting video data, or to save storage space when storing video data, a video data must be compressed. The data compression is generally to remove surplus data from the video data for the purpose of reducing data. For example, when a previous frame is similar to the next frame, the first frame is kept and the like parts in the following frames are removed; that is, only the different parts are retained. Therefore, the amount of digital video data can be substantially reduced. For example, MPEG video compression standard is a popular video encoding method.

FIG. 1is a schematic drawing of a conventional video encoding method. As shown inFIG. 1, motion estimation110compares digital video data DATA with reference frame data RF, and outputs motion estimation result111. The conventional video content complexity estimation and the scene change detection120use the motion estimation result111to perform estimation and detection. According to the motion estimation result111, motion compensation130compensates the received reference frame data RF and generates a compensation data131. Transform coding140and quantization150can be performed after the digital video data DATA subtracts the compensation data131, and further a quantized data151is generated. Further, according to the motion estimation result112and the quantized data151, entropy coding160, which is for example variable length coding, is performed, and a digital video data OUT which has been completely compressed is generated.

The above-mentioned reference frame data RF generally is a data181which is obtained after inverse-quatization170and inverse-transform coding180are performed to the quantized data151. The reference frame data RF is obtained after a compensation data132is added to the data181.

When digital video is applied at different environments, the different transmission and storage characteristics require a distinct encoding process. Especially, most transmission systems are constant bit rate (CBR) transmission. In order to maintain the CBR at video encoding process, most encoding devices must be equipped with a rate control module. In any rate control module, an important core element, video content complexity estimation device, must be included. A conventional rate control module performs the video content complexity estimation in a frame encoding loop (i.e. after motion estimation110as shown inFIG. 1). Generally speaking, in a video encoding device on a system on chip (SoC) platform, the video content complexity estimation is performed on MCU, and video-encoding loop (i.e. motion estimation, transform, quatization and entropy encoding) is performed on ASIC accelerator core. However, in the conventional technology, because the complexity estimation must be performed after the motion estimation is accomplished, data is frequently transmitted between the MCU and the ASIC calculation cores. In other words, a lot of time is spent on communication between the MCU and the ASIC calculation cores, and therefore the video encoding efficiency is decreased.

SUMMARY OF THE INVENTION

An object of the present invention is to provide a method of video content complexity estimation, which utilizes original video data followed by a video encoding loop process, for performing the complexity estimation of a P-frame.

An object of the present invention is to provide a method of video content complexity estimation, which utilizes original video data followed by a video encoding loop process, for performing the complexity estimation of an I-frame.

An object of the present invention is to provide a method of scene change detection, which utilizes original video data followed by a video encoding loop process, for performing the scene change detection.

An object of the present invention is to provide a method of video encoding, which utilizes original video data followed by a video encoding loop process, for performing the video encoding rate control.

The present invention provides a method of video content complexity estimation, for calculating the complexity of the P-frame. The method of video content complexity estimation is described as follows. First, diffiis calculated, wherein diffirepresents an absolute difference value of ithpixel between a current frame and a reference frame, wherein i is an integer. Further

mean⁢⁢(R)=1NM⁢∑i∈R⁢diffi
is calculated, wherein R represents N×M pixel region, mean(R) represents a mean value of the pixel region R. Further,

deviation⁢⁢(R)=∑i∈R⁢abs(diffi-mean⁢⁢(R))
is calculated, wherein deviation(R) represents an deviation value of the pixel region R, abs( ) represents an absolute value. Furthermore,

X=∑R∈frame⁢mean⁢⁢(R)·deviation⁢⁢(R)
is calculated, wherein X represents a complexity estimation of a target frame. Finally, Ĉtarget=a·X/b is calculated, wherein target Ĉtargetrepresents an adjusted complexity of the target frame, a is an integer and b is power of 2. Further, a is calculated again by a formulation a=b·SADtarget/X after each frame is encoded, wherein SADtargetrepresents a true motion compensated sum of absolute difference value of the target frame.

The present invention provides another method of video content complexity estimation, for calculating the complexity of the I-frame. The method of video content complexity estimation is described as follows. First,

mean(R)=1NM⁢∑i∈R⁢lumai
is calculated, wherein R represents N×M pixel region, mean(R) represents a mean value of the pixel region R, and lumairepresents a luminance intensity of ithpixel, and i is an integer. Further,

deviation⁢⁢(R)=∑i∈R⁢abs⁡(lumai-mean⁢⁢(R))
is calculated, wherein deviation(R) represents a deviation value of the pixel region R, abs( ) represents an absolute value. Further,

XI=∑R∈frame⁢mean⁢⁢(R)·deviation⁢⁢(R)
is calculated, wherein XIrepresents a complexity estimation of the target I-frame. Finally, Ĉtarget=aI·XI/b is calculated, wherein Ĉtargetrepresents an adjusted complexity of the target I-frame, aIis integer and b is power of 2. Further, aIis calculated again by a formulation aI′=aI·Rtarget/Rtrueafter the target I-frame is encoded, wherein aI′ represents aIof the next target I-frame, Rtargetrepresents a size of the target I-frame, Rtruerepresents a true size of the target I-frame. Wherein, the target I-frame is accomplished by utilizing Dtargetfor encoding, and Dtargetrepresents a distortion value of the target frame.

The present invention provides a method of scene change detection, which comprises the following steps. First, diffiis calculated, wherein diffirepresents a frame absolute difference of ithpixel between a current frame and a reference frame, wherein i is an integer. Further,

mean⁡(R)=1NM⁢∑i∈R⁢diffi
is calculated, wherein R represents N×M pixel region, mean(R) represents a mean value of the pixel region R. Further,

deviation⁢⁢(R)=∑i∈R⁢abs⁡(diffi-mean⁢⁢(R))
is calculated, wherein deviation(R) represents a deviation value of the pixel region R, abs( ) represents an absolute value. Finally,

X=∑R∈frame⁢mean⁢⁢(R)·deviation⁢⁢(R)
is calculated, wherein X represents a complexity estimation of a target frame. When X is greater than a critical value, the target frame is a scene change frame. Wherein, after calculating multi X values, the critical value is decided by selecting the minimum value from the multiple X values.

The present invention provides a method of video encoding, which comprises the following steps. First, original video data are provided. Further, video content complexity estimation and scene change detection are performed to the original video data. Further, a video encoding rate control is performed according to the results of the video content complexity estimation and the scene change detection. Finally, an encoding loop calculation is performed to the original video data according to a result of the video encoding rate control.

In accordance with the method of video encoding of the embodiment of the present invention, the video encoding loop calculation comprises motion estimation, transform, quatization and entropy encoding. For example, MPEG dynamic video compression standard is utilized for the video encoding loop calculation.

In the present invention, before the video encoding loop is performed, the rate control mechanism is performed according to the original video data, including the video content complexity estimation and scene change detection. In this way, the communication requirement between the MCU and the ASIC calculation cores are reduced, and thus the video encoding efficiency is increased.

The above is a brief description of some deficiencies in the prior art and advantages of the present invention. Other features, advantages and embodiments of the invention will be apparent to those skilled in the art from the following description, accompanying drawings and appended claims.

DESCRIPTION OF THE EMBODIMENTS

FIG. 2is a schematic drawing of video encoding method according to an embodiment of the present invention. As shown inFIG. 2, the important core calculation of the rate control function, video content complexity estimation and scene change detection210, receives original video data DATA. In the conventional technology, the complexity estimation must be performed after accomplishing the motion estimation. In the present invention, the embodiment of the present invention performs the video content complexity estimation and scene change detection210outside the video encoding loop200. In general, the video content complexity estimation and scene change detection210are performed in the MCU core, and the video encoding loop200are performed in the ASIC calculation core, therefore the present invention is specially suitable for the structure of system on chip (SoC).

As shown inFIG. 2, in the video encoding loop200, the motion estimation220compares the video data DATA with a reference frame data RF, and outputs a motion estimation result221. According to a motion estimation result221, motion compensation230compensates the received reference frame data RF and creates a compensation data231. After the video data DATA subtracts the compensation data231, transform coding240and quantization250can be performed, and a quantized data251is generated. Further, According to the motion estimation result222and the quantized data251, entropy coding260is performed, and finally a compressed video data OUT is generated.

In order to reconstruct the reference frame data RF, in general, inverse quantization270and inverse transform coding280are performed to the quantized data251, and data281is obtained. Further, the reference frame data RF is obtained after the data281is added with a compensation data232.

FIG. 3is a flow chart of video encoding method according to an embodiment of the present invention. As shown inFIG. 2andFIG. 3, the original data DATA is provided at the step S310. Further, the video content complexity estimation at the step S320and the scene change detection at the step S330are performed to the original data DATA, as shown in210ofFIG. 2. Further, according to the results at the step S320and the step S330, video encoding rate control is performed at the step S340. At the step S350, according to the video encoding rate control at the step S340, encoding loop calculation200is performed to the original data DATA.

In the above-mentioned embodiment, the step S320can be performed in accordance withFIG. 4.FIG. 4is a flow chart of video content complexity estimation in P-frame according to an embodiment of the present invention. When calculating the video content complexity estimation in the P-frame, an absolute difference value diffiof the corresponding pixels between a recent frame and a reference frame is calculated at the step S410. Wherein diffirepresents an absolute difference value of ithpixel, and i is an integer. At the step S420, a mean value of a pixel region R

At the step S430, a deviation value of the pixel region R

deviation⁢⁢(R)=∑i∈R⁢abs⁡(diffi-mean⁢⁢(R))
is calculated, wherein abs( ) represents an absolute value. Further, at the step S440, a complexity estimation of a target frame X is calculated in accordance with a formula

X=∑R∈frame⁢mean⁢⁢(R)·deviation⁢⁢(R).
At the step S450, an adjusted complexity of the target frame Ĉtarget=a·X/b is calculated, wherein, a is an integer that is generated after calculating the previous frame at the step S460, for example, and b is power of 2, for example, 216. Finally, after each frame is encoded, at the step S460, a=b·SADtarget/X is calculated again for next frame, wherein SADtargetrepresents a true motion compensated sum of absolute difference value for the target frame.

When the recent frame is I-frame, the above-mentioned step S320as shown inFIG. 3can be performed in accordance withFIG. 5.FIG. 5is a flow chart of video content complexity estimation in I-frame according to an embodiment of the present invention. Because the I-frame does not have a reference frame, a luminance mean value of the pixel region R

mean⁢⁢(R)=1NM⁢∑i∈R⁢lumai
is calculated at the step S510, wherein R represents N×M pixel region, and lumairepresents a luminance intensity of ithpixel, wherein i is an integer. Further, a deviation value of the pixel region R

deviation⁢⁢(R)=∑i∈R⁢abs⁡(lumai-mean⁢⁢(R))
is calculated at the step S520, wherein abs( ) represents an absolute value.

Further, a complexity estimation of a target I-frame

XI=∑R∈frame⁢mean⁢⁢(R)·deviation⁢⁢(R)
is calculated at the step S530. At the step S540, Ĉtarget=aI·XI/b, is calculated, wherein aIis integer which is generated after calculating a previous frame at the step S550, for example, and b is power of 2, for example, 216. After the target I-frame is encoded, aI′=aI·Rtarget/Rtrueis calculated again at the step S550, wherein aI′ represents aIof next target I-frame, Rtargetrepresents a size of the target I-frame, Rtruerepresents a true size of the target I-frame. In the embodiment of the present invention, the above-mentioned target I-frame is accomplished by utilizing Dtargetfor encoding, and Dtargetrepresents a distortion value of the target frame.

Further, the above-mentioned step S330inFIG. 3can be implemented in accordance withFIG. 6.FIG. 6is a flow chart of scene change detection method according to an embodiment of the present invention. As shown inFIG. 6, the steps S610to S640are the same as the steps S410to S440inFIG. 4, so they are not described here. At the step S650, the complexity estimation of a target P-frame X is compared with a critical value, when the complexity X is larger than the critical value, the target frame is judged as the scene change frame at the step S660; otherwise, as a non-scene change frame at the step S670. Wherein, the critical value can be decided by selecting the minimum value from the multiple X values. In the embodiment of the present invention, the critical value is, for example, 12,000,000×(γ/25344), wherein γ represents total pixel amount of a frame.

The above description provides a full and complete description of the preferred embodiments of the present invention. Various modifications, alternate construction, and equivalent may be made by those skilled in the art without changing the scope or spirit of the invention. Accordingly, the above description and illustrations should not be construed as limiting the scope of the invention, which is defined by the following claims.