Abstract:
A method and related circuit for detecting black frames, which are inserted between normal programs and commercial spots in a broadcasting video signal. For a frame in the video signal, representative pixels are selected as reference pixels according to their positions in the frame, and whether the frame is black can be determined efficiently according to statistical properties of these reference pixels. For example, pixels aligned in a diagonal of a frame can be selected as reference pixels to determine if the frame is black. Also, the invention applies to frequency domain video signals. Blocks are selected as reference blocks according to their position in a frame, and whether the frame is black is determined according to low-frequency components of reference blocks.

Description:
BACKGROUND OF INVENTION  
       [0001]     1. Field of the Invention  
         [0002]     The present invention provides a method for detecting commercial-spot frames, and more particularly, a method and related circuit for detecting black frames with a few but representative pixels.  
         [0003]     2. Description of the Prior Art  
         [0004]     Video programs from mass media provide news, knowledge, and entertainments for audiences. However, considering commercial pursuits, the programs are often alternated with commercials, which breaks coherence and wastes time. Therefore, how to filter out commercials within a video program becomes one of the most important issues for development in modern information technology  
         [0005]     Please refer to  FIG. 1 , which illustrates a schematic diagram of a video signal  10 . The motion (dynamic) video signal  10  includes parts of a program and commercials. The video signal  10  can be regarded as a combination of a series of frames each showing an image. Playing the frames with a proper frequency (frame rate) can show the dynamic video. In the video signal  10 , the frames Fa 1  to FaN, and Fd 1  to FdQ are different parts of the program, while the frames Fb 1  to FbM, and Fc 1  to FcP are two commercial spots. In general, many countries have ruled that an interval between a part of the program and a commercial spot should be included in the video signal  10 , so that a black frame sequence is introduced for separating the program from the commercial spot. This so-called a black frame is a full black frame, and combining such black frames forms a black frame sequence, such as sequences from frames B 1   a  to B 1   b , frames B 2   a  to B 2   b , and frames B 3   a  to B 3   b  shown in  FIG. 1 .  
         [0006]     Therefore, as long as the black frames can be detected in the video signal  10 , the separated program can be reconstructed into a whole program by filtering out the commercial spots. As those skilled in the art recognize, each frame can be regarded as a combination of a plurality of pixels each having a tint and a brightness. Pixels of a black frame are all (basically uniformly) black, so that differences between any two pixels of the black frame are quite little. As a result, a prior art detection method is to calculate a brightness mean and a brightness variance of the pixels of each frame for determining whether a frame is a black frame with small brightness mean and variance. However, the above method requires a lot of calculations and system resources, and so the efficiency of black frame detection is low.  
         [0007]     Another prior art black frame detection method is to analyze histograms of all pixels of a frame, which sorts the pixels into different bins according to brightness of each pixel, and calculates a brightness mean and a brightness variance of the pixels in a low-brightness bin. Although this method only deals with the pixels in the low-brightness bin, it has to analyze histograms of all the pixels of the frame, equivalently calculating all the pixels. Therefore, the efficiency of black frame detection cannot be improved.  
       SUMMARY OF INVENTION  
       [0008]     It is therefore a primary objective of the claimed invention to provide a method and related circuit for detecting black frames.  
         [0009]     According to the claimed invention, a method for detecting a black frame of a video signal includes: (a) receiving a frame data from the video signal. The frame data includes a plurality of pixel data each corresponding to a pixel of an image. (b) processing a setting step for setting a pattern including a plurality of reference positions. (c) processing a sampling step for determining reference pixels according to positions of the pixels in the image. A pixel of the image is determined as a reference pixel if the position of the pixel equals a reference position. The pattern limits the number of reference pixels to be smaller than the number of pixels of the image, and keeps the number of reference pixels from changing as the pixel data corresponding to the pixels of the image change; and (d) processing a decision step for determining whether the pixel data corresponding to the pixels of the image fit a default according to the pixel data corresponding to the reference pixels.  
         [0010]     These and other objectives of the claimed invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings. 
     
    
     BRIEF DESCRIPTION OF DRAWINGS  
       [0011]      FIG. 1  illustrates a schematic diagram of a prior art video signal.  
         [0012]      FIG. 2  illustrates a block diagram of a processing circuit of the present invention.  
         [0013]      FIG. 3  illustrates a frame data diagram of the processing circuit in  FIG. 2 .  
         [0014]      FIG. 4  illustrates a schematic diagram of the processing circuit in  FIG. 2  when processing black frame detection.  
         [0015]      FIG. 5  to  FIG. 7  illustrate schematic diagrams of the processing circuit in  FIG. 2  when selecting references pixels according to different patterns.  
         [0016]      FIG. 8  illustrates a schematic diagram of a process of one-tier black frame detection.  
         [0017]      FIG. 9  illustrates a schematic diagram of a process of multi-tier black frame detection.  
         [0018]      FIG. 10  illustrates a schematic diagram of a processing circuit for detecting a black frame with frequency-domain data.  
         [0019]      FIG. 11  illustrates a frame data diagram of the processing circuit in  FIG. 10 .  
         [0020]      FIG. 12  illustrates a schematic diagram of the processing circuit in  FIG. 10  when processing black frame detection. 
     
    
     DETAILED DESCRIPTION  
       [0021]     Please refer to  FIG. 2 , which illustrates a block diagram of a present invention processing circuit  20 . The processing circuit  20  includes a receiver  22 , a sampling module  24 , a setting module  26 , and a decision module  28 . The receiver  22  includes decoding and demodulation circuits for drawing a video signal  32 B out from a signal  32 A. The signal  32 A is provided by a mass media or a storage device (such as a VCD-player, DVD-player or a hard disk), while the video signal  32 B includes a plurality of frame data each corresponding to a frame. The setting module  26  stores one or more patterns PT each corresponding to a plurality of reference positions. When detecting each frame in the video signal  32 B, the sampling module  24  samples a frame according to the patterns PT, so as to determine reference pixels, which are the pixels of the frame having positions matching the reference positions. The decision module  28  can determine whether the frame is a black frame based on statistic characters of the reference pixels. In a preferred embodiment, the decision module  28  includes a mean decision module  30 A and a deviation decision module  30 B for calculating a mean M 0  and a deviation V 0  (or a variance) according to the reference pixels, so as to determine the black frame with the mean M 0  and the deviation V 0 .  
         [0022]     Please refer to  FIG. 3  (also  FIG. 2 ), which illustrates a timing diagram of the signals of the processing circuit  20 . As mentioned above, the video signal  32 B includes frame data FD 1 , FD 2 , etc. corresponding to frames F 1 , F 2 , etc. Each frame data includes a plurality of pixel data for recording corresponding information, such as tint, brightness, etc. For example, the frame F 1  includes pixels px 11 , px 12 , px 13 , etc, and accordingly, the frame data FD 1  includes pixel data pd 11 A, pd 11 B, and pd 11 C for describing the tint and brightness of the pixel px 11 , and pixel data pd 12 A, pd 12 B, pd 12 C for describing the pixel px 12 . That is, the pixel data pd 11 A, pd 11 B, and pd 11 C are RGB (red, green, blue) quantities if the video signal  32 B is defined by RGB, or the pixel data pd 11 A, pd 11 B, and pd 11 C are Y, RY, BY signals if the video signal  32 B is defined chromatically.  
         [0023]     Please refer to  FIG. 4  (also  FIG. 2 ), which illustrates a schematic diagram of the present invention when processing the black frame detection. The pattern PT stored in the setting module  26  is diagonal. When the processing circuit  20  determines whether a frame F of the video signal  32 B is a black frame, the sampling module  24  selects pixels pxD 1 , pxD 2 , pxD 3  to pxDN as reference pixels according to diagonal of the pattern PT, and reads pixel data (such as brightness signals Y of the reference pixels) pdD 1 , pdD 2 , pdD 3  to pdDN from the video signal  32 B. Then, the mean decision module  30 A of the decision module  28  calculates a mean M 0  according to the pixel data pdD 1  to pdDN, while the deviation decision module  30 B calculates a deviation V 0  for determining a deviation degree of each pixel data from the mean M 0 , such as a variance.  
         [0024]     After calculating the mean M 0  and the deviation V 0 , the decision module  28  determines that the frame F is a black frame if the mean M 0  and the deviation V 0  are smaller than a threshold mean and a threshold deviation meaning that the reference pixels pxD 1  to pxDN are low brightness, and vary little.  
         [0025]     As those skilled in the art should recognize, as long as the pattern PT includes both sides and the middle of the frame F, the sampling module  24  can determine enough pixels to represent the frame F. Please refer to  FIG. 5  (also  FIG. 2 ), which illustrates a plurality of embodiments of the pattern PT, labeled as PT 1  to PT 15 . Lines of the patterns PT 1  to PT 15  shows positions of the reference pixels, such as diagonals, crosscuts, midlines, or their combinations. Take the patterns PT 4  and PT 15  for example; the sampling module  24  selects the reference pixels along the midline of the frame F according to the pattern PT 4 , or along the midline, crosscut, and two diagonals of the frame F according to the pattern PT 15 . Therefore, the reference pixels selected from a frame are fewer than the exact pixels of the frame, but enough to represent the frame, so that efficiency of black frame detection can be increased.  
         [0026]     In addition, the above-mentioned threshold mean and deviation can be dynamically changed as the frame changes. For example, after the reference pixels are determined, the present invention can set the threshold mean according to each pixel data of the reference pixels, such as the 70% value of the maximum pixel data, or the difference between the maximum and the minimum pixel data.  
         [0027]     Please refer to  FIG. 6 , which illustrates a schematic diagram of a pattern PT 1   b . The pattern PT 1   b  derived from the pattern PT 1  in  FIG. 5  locates pixel positions in the diagonal of a frame with a specific interval, so as to determine black frames with fewer reference pixels. Basically, the patterns PT 1  to PT 15  in  FIG. 5  can derive such advanced sampling with specific intervals.  
         [0028]     Other than the linear patterns in  FIG. 4  to  FIG. 6 , please refer to  FIG. 7 , which illustrates a schematic diagram of a pattern PT 16 . The pattern PT 16  indicates the reference positions with a plurality of uniform spread rectangles (as hatched areas shown in  FIG. 7 ), so that the sampling module  24  selects the reference pixels from the frame F according to the rectangles of the pattern PT 16  as intersection areas shown in  FIG. 7 . Certainly, with changing the size of each rectangle of the pattern PT 16 , other patterns can be derived from the pattern PT 16 , such as a derivational pattern having uniform spread rectangles each corresponding to only one pixel.  
         [0029]     Please refer to  FIG. 8 , which illustrates a flowchart of a process  100  of black frame detection. The process  100  includes the following steps:  
         [0030]     Step  102 : start a black frame detection.  
         [0031]     Step  104 : select reference pixels from a frame F according to a first pattern.  
         [0032]     Step  106 : calculate statistic characters of the reference pixels, such as a mean and a deviation, and determining whether the mean and the deviation are smaller than a threshold mean and a threshold deviation. If true, the process  100  proceeds to step  110 , otherwise it proceeds to step  108 .  
         [0033]     Step  108 : the frame F is not a black frame.  
         [0034]     Step  110 : the frame F is a black frame.  
         [0035]     Step  112 : finish.  
         [0036]     Please refer to  FIG. 9 , which illustrates a flowchart of a two-tier black frame detection of a process  200 . The process  200  is different from the process  100 , which is so-called a one-tier black frame detection. The process  200  includes the following steps:  
         [0037]     Step  202 : start a two-tier black frame detection.  
         [0038]     Step  204 : select reference pixels (designated as first-group reference pixels) from a frame F according to a first pattern.  
         [0039]     Step  206 : calculate statistic characters of the first-group reference pixels, such as a mean and a deviation (first-group mean and deviation), and determine whether the first-group mean and the first-group deviation are smaller than a threshold mean and a threshold deviation. If true, the process  200  proceeds to step  214 , otherwise it proceeds to step  208 .  
         [0040]     Step  208 : select reference pixels (designated as second-group reference pixels) from the frame F according to a second pattern. The second pattern can include more reference pixels than the first pattern, so as to calculate the statistic characters more accurately.  
         [0041]     Step  210 : calculate statistic characters of the second-group reference pixels, such as a mean and a deviation (second-group mean and deviation), and determine whether the second-group mean and the second-group deviation are smaller than a threshold mean and a threshold deviation. If true, the process  200  proceeds to step  214 , otherwise it proceeds to step  212 .  
         [0042]     Step  212 : the frame F is a black frame.  
         [0043]     Step  214 : the frame F is not a black frame.  
         [0044]     Step  216 : finish.  
         [0045]     The process  200  can be compatible with the process  100  if the process  200  proceeds to step  212  rather than step  208  in step  206  when the first-group mean and the first-group deviation are not smaller than the threshold mean and the threshold deviation. In addition, the threshold mean and the threshold deviation in step  212  can be different from those in step  206 . Other than the two-tier detection, three or more tier detection can also be derived from  FIG. 8  and  FIG. 9 .  
         [0046]     As those skilled in the art should recognize, in order to decrease transmission bandwidth and storage space for a video signal, MPEG (Motion Picture Experts Group) compression protocol, for example, is utilized, so that each frame of the video signal is divided into a plurality of blocks (each block includes 8*8 pixels, for example) each undergoing a frequency-domain transformation (such as two-dimensional discrete cosine transformation), so as to transform the pixel data of each block into data in the frequency domain. Then, a compressed video signal is generated by taking a variable length coding for the data in the frequency domain. Oppositely, when decompressing the compressed video signal, the data in the frequency domain is decoded with a variable length decoding for an inverse frequency-domain transformation (such as two-dimensional discrete cosine inverse transformation) into the pixel data, so as to reconstruct the original frame. The present invention can detect a black frame after the variable length decoding, but before the inverse frequency-domain transformation.  
         [0047]     Please refer to  FIG. 10 , which illustrates a schematic diagram of a processing circuit  40 . The processing circuit  40  includes a receiver  42 , a sampling module  46 , a setting module  48 , and a decision module  50 . The receiver  42  includes a decoding circuit for extracting a frequency-domain video signal  54 B, which stores the data in the frequency domain of each block, from a compressed signal  54 A. The setting module  48  stores one or more patterns PTf for the sampling module  46  to select the reference blocks from a frame, while the decision module  50  calculates statistic characters according to the data in the frequency domain (especially the low-frequency data or direct current data) corresponding to the reference blocks for determining whether the frame is a black frame. In addition, the decision module  50  can include a mean decision module  52 A and a deviation decision module  52 B for calculating a mean Mf and a deviation Vf according to the data corresponding to the reference blocks.  
         [0048]     Please refer to  FIG. 11  (also  FIG. 10 ), which illustrates a timing diagram of signals of the processing circuit  40 . The video signal  54 B includes a plurality of frequency-domain frame data FDf 1 , FDf 2 , etc. each capable of being transformed into a frame. In  FIG. 11 , a frame Fm 1  corresponding to the frequency-domain frame data FDf 1  includes a plurality of blocks Bk 1 , Bk 2  to BkN each including a plurality of pixels arranged in a matrix. As mentioned above, each pixel data corresponding to a pixel of a block will undergo a frequency-domain transformation, so that frequency-domain data Ce 1 , Ce 2  to CeQ stored in the frequency-domain frame data FDf 1  are obtained after transforming the pixel data of the block Bk 1  into the frequency domain. Similarly, frequency-domain data CeN 1  to CeNQ are obtained after transforming the pixel data of the block BkN into the frequency domain.  
         [0049]     Please refer to  FIG. 12  (also  FIG. 10 ), which illustrates a schematic diagram of the present invention when detecting the black frame according to the frequency-domain frame data of a frame F. The sampling module  46  selects blocks BkD 1  to BkDL as the reference blocks according to the diagonal of a pattern PTf, and draws direct-current data CeD 1  to CeDI from the blocks BkD 1  to BkDL. Then, the decision module  50  calculates the character statistics (such as the mean Mf and the deviation Vf) of the direct-current data CeD 1  to CeDI, so as to determine whether the frame F is a black frame. For example, if the mean Mf is smaller than a threshold mean and the deviation Vf is smaller than a threshold deviation, the frame F is a black frame. Also, the deviation Vf in  FIG. 10  can be obtained by an absolute value calculation.  
         [0050]     When taking frequency-domain transformation of pixel data of each pixel of a block, the pixel data are multiplied by different weights, equivalently. Particularly, the direct-current data are summaries of the pixel data of the blocks. Therefore, the direct-current data corresponding to a reference block corresponds to the summary of the pixel data corresponding to the reference block. In other words, with statistic characters of direct-current data corresponding to the reference blocks, the black frame can be detected according to the mean and the deviation of the direct-current data.  
         [0051]     In addition, when detecting the black frame with the frequency-domain transformation, the patterns in  FIG. 5 ,  FIG. 6 , and  FIG. 7  can be used, and so can the multi-tier detection of  FIG. 9 .  
         [0052]     When detecting the black frame, the prior art uses much system resources for calculating all pixels of each frame, but the present invention is based on a few reference pixels enough to represent a frame. Therefore, the present invention can increase the efficiency of black frame detection and decrease the demand on system resources. Besides, the processing circuit of  FIG. 2  or  FIG. 10  can be implemented with hardware, software, or firmware.  
         [0053]     Those skilled in the art will readily observe that numerous modifications and alterations of the device may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.