Abstract:
A method of measuring peak signal to noise ratio (PSNR) of full color video, both total and component contributions as well as providing PSNR full color and component maps includes converting the components of the full color video for both reference and impaired video signals to RGB values, and computing the error energy for each of the G, B and R channels between the reference and impaired video signals. Each component contribution to the error for the full color video components is assessed by setting the other components to a reference value, such as zero. Also the total full color PSNR is computed in RGB. Finally a color residual PSNR map is generated and displayed together with the computed PSNR results to enable a user to visualize where the significant impairments occur in the impaired video.

Description:
BACKGROUND OF THE INVENTION 
     The present invention relates to video quality of service, and more particularly to a method of measuring peak signal to noise ratio (PSNR) of full color video, both total and component contributions. 
     It is desired to quantify the error in color related components—chrominance, color difference, etc.—of video signals in an objective manner using units compatible with existing industry standards. PSNR is such a method for luminance only, as defined in ANSI® T1.801.03-1996 : Digital Transport of One - Way Video Signals—Parameters for Objective Performance Assessment , page 35. An implementation of this standard is found in the PQA200 and PQA300 Picture Quality Analyzers manufactured by Tektronix, Inc., Beaverton, Oreg. PSNR is a measurement that gives one value for each frame or sequence of frames of the video signal under test, given the reference frame or sequence. It is also desirable to have an error map, similar to the luminance difference map, labeled “PSNR” map in the TEKTRONIX® PQA200/300 products, that displays luminance and chrominance errors simultaneously in an intuitive manner. And finally it is desirable to measure the contribution of constituent video components, i.e., C b  of YC b C r , to the total PSNR measurement. 
     PSNR stands for Peak Signal to Noise Ratio and is proportional to the log of a ratio of root mean square (rms) values. From ANSI® T1.801.03-1996:
 
 PSNR ( V   peak   ,C   in   ,C   out   ,N   col   ,N   row   ,i,j,t,d ):=20*log [ V   peak /{SQRT((1/( N   col   *N   row ))*Σ j Σ i ( C in i,j,t-d   −C out i,j,t ) 2 )}
 
where C in  and C out  are general image parameters, V peak  is the reference peak unit value for C in  and C out , N col  is the number of columns (width) of parameter matrix C, N row  is the number of rows (height) of parameter matrix C, i is the row index, j is the column index, t is the time index, and d is the delay between C in  and C out . The ratio taken is the peak rms value possible for the measure divided by the actual rms difference between the test (C out ) and reference (C in ) video signals. PSNR for the TEKTRONIX® PQA200/300 products and most measurements within the ANSI® document cited above, as well as other picture quality of service (PQOS) methods, use C in  and C out  taken directly or indirectly from the pixel luminance (Y) values alone. V peak  is taken as peak white.
 
Lum PSNR ( Y   peak   ,Y   in   ,Y   out   ,N   col   ,N   row   ,i,j,t,d ):=20*log [ Y   peak /{SQRT((1/( N   col   *N   row ))*Σ j Σ i ( Y in i,j,t-d   −Y out i,j,t ) 2 )}
 
Thus chrominance errors that occur independent from luminance errors are undetected by these PSNR measures.
 
     BRIEF SUMMARY OF THE INVENTION 
     Accordingly the present invention provides a method of measuring peak signal to noise ratio (PSNR) of full color video, both total and component contributions as well as providing PSNR full color and component maps. The components of the full color video for both reference and impaired video signals are converted to RGB values, and the error energy for each of the G, B and R channels between the reference and impaired is computed. Each component contribution to the error for the full color video components is assessed by setting the other components to a reference value, such as zero. Also the total full color PSNR is computed in RGB. Finally a color residual PSNR map is generated and displayed together with the computed PSNR results to enable a user to visualize where the significant impairments occur in the impaired video. 
     The objects, advantages and other novel features of the present invention are apparent from the following detailed description when read in conjunction with the appended claims and attached drawing. 
    
    
     
       BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWING 
         FIG. 1  is a flow chart view of the process for measuring peak signal to noise ratio of full color video according to the present invention. 
         FIG. 2  is a color image view of a reference full color video. 
         FIG. 3  is a color image view of an impaired full color video corresponding to the reference full color video. 
         FIG. 4  is a color image view of a residual color PSNR map according to the present invention. 
     
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     Referring now to  FIG. 1  in order to include chrominance, the C b  and C r  channels for example, in the PSNR calculation a method is formulated as detailed below that converts YC b C r  to RGB in step  12  and computes PSNR in RGB in step  18 . The contributions of each channel may be assessed in step  16 , i.e., C b  PSNR may be measured simply by replacing the other channel test values with reference values, such as zero. 
     The conversion between YC b C r  and RGB in step  12 , i.e., color matrix operations to transcode  422 , Y, C r , C b  to/from RGB,  700  my sources, is as follows: 
     For the  422  input define reconstructed  422  source input matrix (from CCIR Recommendation  601 - 1 ) as
 
[ Y,C   b   ,C   r   ]:=M 422*[ G,B,R] 
 
where M422:=[0.587 0.114 0.299; −0.331 0.500 −0.169; −0.419 −0.081 0.500]. Therefore to convert Y, C b , C r  422 signals to RGB, multiply by the inverse
 
[ G,B,R]:=M 422 −1   *[Y,C   b   ,C   r ]
 
where M422 −1 :=[1 −0.344 −0.714; 1 1.772 9.902×10 −4 ; 1 −9.267×10 −4  1/402]:=Mycbcr2rgb.
 
     The luminance PSNR definition in RGB is:
 
 Y ( R,G,B ):= M 422 0,0   *G+M 422 0,1   *B+M 422 0,2   *R  
 
or
 
 Y ( R,G,B ):=0.587* G+ 0.114* B+ 0.299* R  
 
and for the case where C b  and C r  differences are neglected (treated as zero)
 
                     R   ⁡     (   Y   )       :=       Mycbcr2rgb     2   ,   0       ⁢           *   Y                   G   ⁡     (   Y   )       :=       Mycbcr2rgb     0   ,   0       ⁢           *   Y                   B   ⁡     (   Y   )       :=       Mycbcr2rgb     1   ,   0       ⁢           *   Y                       R   ⁡     (   Y   )       :=   Y               G   ⁡     (   Y   )       :=   Y     ⁢                       B   ⁡     (   Y   )       :=   Y     ⁢                       
and the LumPSNR measurement is rewritten as:
 
               LumPSNR   ⁡     (       Y   peak     ,     Y   in     ,     Y   out     ,     N   col     ,     N   row     ,   i   ,   j   ,   t   ,   d     )       :=     20   *     log   ⁡     [         SQRT   ⁡     (       peak   ⁡     (     R   ⁡     (     Y   peak     )       )       +     peak   ⁡     (     G   ⁡     (     Y   peak     )       )       +     peak   ⁡     (     R   ⁡     (     Y   peak     )       )         )       /     SQRT   ⁡     (     (       1   /     N   col       *     N   row       )     )         ⁢       ∑   j     ⁢           ⁢       ∑   i     ⁢     (         (       R   ⁡     (     Yin     i   ,   j   ,     t   -   d         )       -     R   ⁡     (     Yout     i   ,   j   ,   t       )         )     2     +       (       G   ⁡     (     Yin     i   ,   j   ,     t   -   d         )       -     G   ⁡     (     Yout     i   ,   j   ,   t       )         )     2     +       (       B   ⁡     (     Yin     i   ,   j   ,     t   -   d         )       -     B   ⁡     (     Yout     i   ,   j   ,   t       )         )     2       )           ]               
Checking by substituting the R(Y), B(Y), G(Y) with Y, Y, Y using the definitions above:
 
     
       
         
           
             
               
                 
                   
                     LumPSNR 
                     ⁡ 
                     
                       ( 
                       
                         
                           Y 
                           peak 
                         
                         , 
                         
                           Y 
                           
                             i 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             n 
                           
                         
                         , 
                         
                           Y 
                           out 
                         
                         , 
                         
                           N 
                           col 
                         
                         , 
                         
                           N 
                           row 
                         
                         , 
                         i 
                         , 
                         j 
                         , 
                         t 
                         , 
                         d 
                       
                       ) 
                     
                   
                   := 
                     
                   ⁢ 
                   
                     20 
                     * 
                     
                       log 
                       [ 
                       
                         
                           SQRT 
                           ⁡ 
                           
                             ( 
                             3 
                             ) 
                           
                         
                         * 
                         
                           
                             Y 
                             peak 
                           
                           / 
                           
                             { 
                             
                               SQRT 
                               ( 
                               
                                 
                                   ( 
                                   
                                     3 
                                     / 
                                     
                                       ( 
                                       
                                         
                                           N 
                                           col 
                                         
                                         * 
                                         
                                           N 
                                           row 
                                         
                                       
                                       ) 
                                     
                                   
                                   ) 
                                 
                                 * 
                               
                             
                           
                         
                       
                     
                   
                 
               
             
             
               
                 
                   
                       
                     ⁢ 
                     
                       
                         
                           
                               
                           
                           ∑ 
                         
                         j 
                       
                       ⁢ 
                       
                         
                           ∑ 
                           i 
                         
                         ⁢ 
                         
                           
                             ( 
                             
                               
                                 Yin 
                                 
                                   i 
                                   , 
                                   j 
                                   , 
                                   
                                     t 
                                     - 
                                     d 
                                   
                                 
                               
                               - 
                               
                                 Yout 
                                 
                                   i 
                                   , 
                                   j 
                                   , 
                                   t 
                                 
                               
                             
                             ) 
                           
                           2 
                         
                       
                     
                     ) 
                   
                   } 
                 
               
             
             
               
                 
                   := 
                     
                   ⁢ 
                   
                     20 
                     * 
                     
                       log 
                       [ 
                       
                         
                           Y 
                           peak 
                         
                         / 
                         
                           { 
                           
                             SQRT 
                             ( 
                             
                               
                                 ( 
                                 
                                   1 
                                   / 
                                   
                                     ( 
                                     
                                       
                                         N 
                                         col 
                                       
                                       * 
                                       
                                         N 
                                         row 
                                       
                                     
                                     ) 
                                   
                                 
                                 ) 
                               
                               * 
                             
                           
                         
                       
                     
                   
                 
               
             
             
               
                 
                   
                       
                     ⁢ 
                     
                       
                         
                           
                               
                           
                           ∑ 
                         
                         j 
                       
                       ⁢ 
                       
                         
                           ∑ 
                           i 
                         
                         ⁢ 
                         
                           
                             ( 
                             
                               
                                 Yin 
                                 
                                   i 
                                   , 
                                   j 
                                   , 
                                   
                                     t 
                                     - 
                                     d 
                                   
                                 
                               
                               - 
                               
                                 Yout 
                                 
                                   i 
                                   , 
                                   j 
                                   , 
                                   t 
                                 
                               
                             
                             ) 
                           
                           2 
                         
                       
                     
                     ) 
                   
                   } 
                 
               
             
           
         
       
     
     Now simply by not suppressing C b  and C r  to zero—including actual values—in the definition in R, G, B, a “full color” PSNR becomes:
 
 R ( Y,C   b   ,C   r ):= Mycbcr 2 rgb   2,0   *Y+Mycbcr 2 rgb   2,1   *C   b   +Mycbcr 2 rgb   2,2   *C   r  
 
 G ( Y,C   b   ,C   r ):= Mycbcr 2 rgb   0,0   *Y+Mycbcr 2 rgb   0,1   *C   b   +Mycbcr 2 rgb   0,2   *C   r  
 
 B ( Y,C   b   ,C   r ):= Mycbcr 2 rgb   1,0   *Y+Mycbcr 2 rgb   1,1   *C   b   +Mycbcr 2 rgb   1,2   *C   r  
 
As shown in step  14  the error for each channel is computed as:
 
RerrEngy:=Σ j Σ i ( R ( Y in i,j,t-d   ,Cb in i,j,t-d   ,Cr in i,j,t-d )− R ( Y out i,j,t   ,Cb in i,j,t   ,Cr in i,j,t )) 2  
 
GerrEngy:=Σ j Σ i ( G ( Y in i,j,t-d   ,Cb in i,j,t-d   ,Cr in i,j,t-d )− G ( Y out i,j,t   ,Cb in i,j,t   ,Cr in i,j,t )) 2  
 
BerrEngy:=Σ j Σ i ( B ( Y in i,j,t-d   ,Cb in i,j,t-d   ,Cr in i,j,t-d )− B ( Y out i,j,t   ,Cb in i,j,t   ,Cr in i,j,t )) 2  
 
Color PSNR ( Y   peak ,RerrEngy,GerrEngy,BerrEngy, N   col   ,N   row ):=20*log [(SQRT(3)* Y   peak )/SQRT((1/( N   col   *N   row ))*(RerrEngy+GerrEngy+bErrEngy))]
 
     As an example of “full color” PSNR, for convenience treat input and output video data as a simple set of three channels of one dimensional arrays:
 
 N:= 100  n:= 0  . . . N− 1  Y   peak :=255
 
Generate Y Channels, In &amp; Out:
 
 Y in n :=floor( rnd (1)* Y   peak )
 
Let ErrorLevel:=0.1
 
 Y out n   :=Y in n +floor[( rnd (ErrorLevel)−0.5*ErrorLevel)* Y   peak ]
 
mean( Y   in )=129.57 mean( Y   out )=127.43
 
Generate C b  Channels, In &amp; Out:
 
 Cb in n :=floor( rnd (1)* Y   peak )
 
Let ErrorLevel:=0.1
 
 Cb out n   :=Cb in n +0*floor[( rnd (ErrorLevel)−0.5*ErrorLevel)* Y   peak ]
 
mean( C   bin )=126.41 mean( C   bout )=126.41
 
Generate C r  Channels, In &amp; Out:
 
 Cr in n :=floor( rnd (1)* Y   peak )
 
Let ErrorLevel:=0.1
 
 Cr out n   :=Cr in n +0*floor[( rnd (ErrorLevel)−0.5*ErrorLevel)* Y   peak ]
 
mean( C   nn )=139.24 mean( C   rout )=139.24
 
PSNR, Luminance Only:
 
Lum PSNR:= 20*log [ Y   peak /SQRT((1/ N )Σ n ( Y in n   −Y out n ) 2 )]
 
LumPSNR=31.082 dB
 
“Full Color” PSNR With No Chrominance Errors:
 
RerrEngy:=Σ n [( R ( Y out n   ,Cb out n   ,Cr out n )− R (( Y in n   ,Cb in n   ,Cr in n )) 2 ]
 
GerrEngy:=Σ n [( G ( Y out n   ,Cb out n   ,Cr out n )− G (( Y in n   ,Cb in n   ,Cr in n )) 2 ]
 
BerrEngy:=Σ n [( B ( Y out n   ,Cb out n   ,Cr out n )− B (( Y in n   ,Cb in n   ,Cr in n )) 2 ]
 
FullColor PSNR:= 20*log {(SQRT(3)* Y   peak )/(SQRT(1 /N )*(RerrEngy+GerrEngy+BerrEngy))}
 
FullColorPSNR=31.082 dB LumPSNR=31.082 dB
 
“Full Color” PSNR With Chrominance and Luminance Errors:
 
 Cb out n   :=Cb in n +0.5*floor[( rnd (ErrorLevel)−0.5*ErrorLevel)* Y   peak ]
 
mean( C   bin )=113.44 mean( C   bout )=113.33
 
 Cr out n   :=Cr in n +0.5*floor[( rnd (ErrorLevel)−0.5*ErrorLevel)* Y   peak ]
 
mean( C   rin )=139.24 mean( C   rout )=138.405
 
FullColorPSNR=29.262 dB LumPSNR=31.082 dB
 
“Full Color” PSNR With Only Chrominance Errors:
 
Y out :=Y in  
 
LumPSNR=∞dB
 
 Cb out n   :=Cb in n +0.5*floor[( rnd (ErrorLevel)−0.5*ErrorLevel)* Y   peak ]
 
mean( C   bin )=113.44 mean( C   bout )=113.125
 
 Cr out n   :=Cr in n +0.5*floor[( rnd (ErrorLevel)−0.5*ErrorLevel)* Y   peak ]
 
mean( C   rin )=139.24 mean( C   rout )=139.425
 
FullColorPSNR=33.951 dB
 
“Full Color” PSNR Maximum:
 
                     Yin   n     :=     Y   peak                 Yout   n     :=   0     ⁢                         Cbin   n     :=       Y   peak     *   .5               Cbout   n     :=       -     Y   peak       *   .5                   Crin   n     :=       Y   peak     *   .5               Crout   n     :=       -     Y   peak       *   .5                 LumPSNR=0 dB   Cb out n   :=Cb in n +0.5*floor[( rnd (ErrorLevel)−0.5*ErrorLevel)* Y   peak ]
 
mean( C   bin )=127.5 mean( C   bout )=127.925
 
 Cr out n   :=Cr in n +0.5*floor[( rnd (ErrorLevel)−0.5*ErrorLevel)* Y   peak ]
 
mean( C   rin )=139.24 mean( C   rout )=139.015
 
FullColorPSNR=0.003 dB
 
“Full Color” PSNR Maximum Sensitivity to C b :
 
                     Yin   n     :=     Y   peak               Yout   n     :=   0                 Cbin   n     :=         Y   peak     *     ⁢   .5               Cbout   n     :=       -       Y   peak     *       ⁢   .5                   Crin   n     :=         Y   peak     *     ⁢   .5               Crout   n     :=       -       Y   peak     *       ⁢   .5                 Σ i ( RGB 1 ,−RGB 2 i ) 2 =3
 
 R peakDueTo Cb :=( RGB 2 0   −RGB 1 0 ) 2 =1
 
 G peakDueTo Cb :=( RGB 2 1   −RGB 1 1 ) 2 =1
 
 B peakDueTo Cb :=( RGB 2 2   −RGB 1 2 ) 2 =1
 
 Y peakFactorDueTo Cb :=SQRT(3)
 
Likewise the “Full Color” PSNR Maximum Sensitivity to C r  is the same, i.e.,
 
 Y peakFactorDueTo Cr :=SQRT(3)
 
     Using the above “Full Color” PSNR definition with the proper linear transform, each component of any color space representation may be used to make channel specific PSNR measurements. For example PSNR, C b  only, C r  only, and C b  and C r  (chroma) only PSNR measurements may be made as with luminance only. Likewise in RGB space any combination of R, G and B may be used. And finally any component representation, regardless of color space, may be used for analogous measures. The following are examples of weighting components of “full color” PSNR: 
     Generate Y Channels, In &amp; Out:
 
 Y in n :=floor( rnd (1)* Y   peak  
 
Let ErrorLevel:=0.04
 
 Y out n   :=Y in n +floor[( rnd (ErrorLevel)−0.5*ErrorLevel)* Y   peak ]
 
mean( Y   in )=129.02 mean( Y   out )=128.06
 
Generate C b  Channels, In &amp; Out:
 
 Cb in n :=floor( rnd (1)* Y   peak )
 
Let ErrorLevel:=0.03
 
 Cb out n   :=Cb in n +0.5*floor[( rnd (ErrorLevel)−0.5*ErrorLevel)* Y   peak ]
 
mean( C   bin )=123.84 mean(C bout )=123.54
 
Generate C r  Channels, In &amp; Out:
 
 Cr in n :=floor( rnd (1)* Y   peak )
 
Let ErrorLevel:=0.03
 
 Cr out n   :=Cr in n +0.5*floor[( rnd (ErrorLevel)−0.5*ErrorLevel)* Y   peak ]
 
mean( C   rin )=134.48 mean(C rout )=134.005
 
Assess each component contribution in step  16  to produce PSNR, Luminance Only:
 
LumPSNR=38.627 dB
 
“Full Color” PSNR With Chrominance &amp; Luminance Errors:
 
FullColorPSNR=37.304 dB
 
“C b ” PSNR With Chrominance &amp; Luminance Errors:
 
C b PSNR=46.751 dB
 
“C r ” PSNR With Chrominance &amp; Luminance Errors:
 
C r PSNR=47.92 dB
 
Check Of Component PSNR Vs. “Full Color”:
 
     
       
         
           
             
               
                 
                   CompositePSNR 
                   := 
                     
                   ⁢ 
                   
                     20 
                     * 
                     log 
                     ⁢ 
                     
                       { 
                       
                         
                           Y 
                           peak 
                         
                         / 
                         
                           ( 
                           
                             SQRT 
                             ( 
                             
                               
                                 
                                   ( 
                                   
                                     Y 
                                     peak 
                                   
                                   ) 
                                 
                                 2 
                               
                               / 
                             
                           
                         
                       
                     
                   
                 
               
             
             
               
                 
                   
                       
                     ⁢ 
                     
                       10 
                       
                         ( 
                         
                           CbPSNR 
                           / 
                           10 
                         
                         ) 
                       
                     
                     ) 
                   
                   + 
                   
                     ( 
                     
                       
                         
                           
                             ( 
                             
                               Y 
                               peak 
                             
                             ) 
                           
                           2 
                         
                         / 
                         
                           ( 
                           
                             10 
                             
                               ( 
                               
                                 CrPSNR 
                                 / 
                                 10 
                               
                               ) 
                             
                           
                           ) 
                         
                       
                       + 
                     
                   
                 
               
             
             
               
                 
                   
                     
                         
                       ⁢ 
                       
                         
                           
                             ( 
                             
                               Y 
                               peak 
                             
                             ) 
                           
                           2 
                         
                         / 
                         
                           ( 
                           
                             10 
                             
                               ( 
                               
                                 LumPSNR 
                                 / 
                                 10 
                               
                               ) 
                             
                           
                           ) 
                         
                       
                       ) 
                     
                     ) 
                   
                   } 
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     37.583 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     dB 
                   
                 
               
             
           
         
       
       
         
           
             FullColorPSNR 
             = 
             
               37.304 
               ⁢ 
               
                   
               
               ⁢ 
               dB 
             
           
         
       
     
     The reason for the need to convert to RGB is illustrated by the following example that shows the non-equivalence of using the Y, C b , C r  components directly to compute the FullColorPSNR, C b PSNR and C r PSNR. It is assumed that RGB should be the reference due to the fact that RGB is always a more direct representation of an image in any system that uses light sensors and displays based on RGB.
 
YerrEngy:=Σ n [( Y out n   −Y in n ) 2 ]
 
CberrEngy:=Σ n [( Cb out n   −Cb in n ) 2 ]
 
CrerrEngy:=Σ n [( Cr out n   −Cr in n ) 2 ]
 
                       ColorPSNR   direct     ⁡     (     YerrEngy   ,   CberrEngy   ,   CrerrEngy   ,   N   ,     Y   peck       )       :=       ⁢     20   *     log   [       (       SQRT   ⁡     (   3   )       *     Y   peak       )     /     SQRT   (       (     1   /     (   N   )       )     *                               ⁢     (     YerrEngy   +   CberrEngy   +   CrerrEngy     )     )     ]               :=       ⁢   FullColorDirectPSNR               =       ⁢     42.311   ⁢           ⁢   dB                 
Compare with FullColorPSNR=37.304 dB.
 
Likewise when YerrEngy:=CrerrEngy:=0
 
CbDirectPSNR:=ColorPSNRdirect=51.881 dB
 
Compare with C b PSNR=46.751.
 
In each case there is a difference of approximately 5 dB between the direct and RGB based measurements. Therefore the Y, C b , C r  values are converted to RGB as indicated above.
 
     Likewise the method for luminance only maps involves for each pixel in each video frame of the video signal calculating the absolute difference between the reference and test luminance (Y) values. These absolute difference values are displayed as an image in step  20  which then conveys a one-to-one mapping of the test and reference luminance difference at each pixel location. For adding color difference information the difference in C b  and C r  is similarly calculated. However to display the difference in color, there are two additional requirements: 1) C b  and C r  differences need to be added to a pedestal, i.e., 128 for 8-bit CCIR-601 video signals, instead of using the absolute value; and 2) in the event the luminance difference is near zero, chrominance differences will not be visible in the map, so that sufficient luminance must be added to make the chrominance visible—the amount added is to some extent proportional to the chrominance difference magnitude. 
     
       
         
               
             
               
               
             
               
               
             
               
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
               
             
               
               
             
               
               
               
             
               
               
             
               
               
               
             
               
               
             
               
             
           
               
                   
               
             
             
               
                 void colorDiffMap(BYTE*ref YC b C r , BYTE*imp YC b C r , BYTE*res YC b C r , long 
               
               
                 size) 
               
             
          
           
               
                   
                 { 
               
               
                   
                 long Y,C b ,C r ,C; 
               
               
                   
                 long minC = 16; 
               
               
                   
                 long maxC = 240; 
               
               
                   
                 while((size−) &gt; 0) 
               
               
                   
                 { 
               
             
          
           
               
                   
                 Y = (long)*imp YC b C r ++ − (long)*ref YC b C r ++; 
               
               
                   
                 C b  = (long)*imp YC b C r ++ − (long)*refYC b C r ++; 
               
               
                   
                 C r  = (long)*imp YC b C r ++ − (long)*refYC b C r ++; 
               
               
                   
                 if(Y &lt; 0) Y = −Y 
               
               
                   
                 if(Y &lt; 60) 
               
             
          
           
               
                   
                 { 
                 “ADD LUMINANCE TO LOW LUMINANCE 
               
               
                   
                   
                 LEVELS” 
               
             
          
           
               
                   
                 Y += 20; 
               
               
                   
                 if(C b   2  &gt; C r   2 ) C = C b   
               
               
                   
                 else C = C r;   
               
               
                   
                 if(C &lt; 0) C = −C; 
               
               
                   
                 if(C &gt; 10) Y += 50+(C&gt;&gt;1); 
               
               
                   
                 if(Y &gt; 235) Y = 235; 
               
               
                   
                 if(C &gt; 40 &amp;&amp; Y &gt; 100) 
               
               
                   
                 { 
               
             
          
           
               
                   
                 Y −= C; 
               
               
                   
                 if(Y &lt; 40) Y = 40; 
               
             
          
           
               
                   
                 } 
               
             
          
           
               
                   
                 } 
               
             
          
           
               
                   
                 C b  += 128 
                 “ADD PEDESTAL” 
               
             
          
           
               
                   
                 if (C b  &lt; minC) C b  = minC; 
               
               
                   
                 else if (C b  &gt; maxC) C b  = maxC; 
               
             
          
           
               
                   
                 C r += 128; 
                 “ADD PEDESTAL” 
               
             
          
           
               
                   
                 if(C r  &lt; minC) C r  = minC; 
               
               
                   
                 else if(C r  &gt; MaxC) C r  = maxC; 
               
             
          
           
               
                   
                 *res YC b C r ++ = (BYTE)Y; 
                 “GENERATE RESIDUAL MAP” 
               
             
          
           
               
                   
                 *res YC b C r ++ = (BYTE)C b ; 
               
               
                   
                 *res YC b C r ++ = (BYTE)C r ; } 
               
             
          
           
               
                 } 
               
               
                   
               
             
          
         
       
     
       FIGS. 2 ,  3  and  4  show respectively a reference color image, a corresponding impaired color image and a color PSNR or residual color map. The reference color image is a typical image used for MPEG compression video testing and has a complex background with a moving object, in this case a train rolling a ball along a track. Comparing  FIGS. 2 and 3  there are some readily apparent impairments—see the horses&#39; eyes, the goat, the foreground green bushes, the fence, etc. The resulting color PSNR map shows these impairments in color, with the locations of the most serious impairments being readily ascertainable. 
     Thus the present invention provides a method of measuring peak signal to noise ratio (PNR) of full color video signals, both total and component, by converting component video to RGB, computing error values for each RGB channel, obtaining the contributions of each component by replacing the other component test values with reference values, computing the total PSNR in RGB, and then displaying the results with a corresponding residual color PSNR map.