Log in

View Full Version : SSIM and postprocessing


Manao
10th October 2003, 18:52
I used SSIM ( look here for details (http://forum.doom9.org/showthread.php?s=&threadid=61128) ) in order to measure the effect of postprocessing on an encode. The movie (Ness) lasts 1h45, and is PAL. It is not very noisy, and the mastering is good.

Let's begin with the settings I used to encode the movie :

Avisynth script :
MPEG2Source("I:\Ripp\ness.d2v",cpu2="oooooo")
crop(12,72,-12,-72)
TemporalSoften(3,3,3,6,2)
Convolution3D(0,3,4,3,4,2.6,0)
LanczosResize(704,304)
XviD's settings : HVS-Good matrix, VHQ 4, B-Frame 2,150,75,10, Chroma motion and Chroma optimizer. There was no credit range, since the credits were on a moving background. I made a two pass encoding, aiming a size of 567600 Ko ( ~ 700 Kb/sec )

Then, I used the following script to compare the SSIM value between the result, or the result postprocessed, and the original clip ( without any filtering, except resizing ) :
Source2 = MPEG2Source("I:\Ripp\ness.d2v",cpu2="oooooo").crop(12,72,-12,-72)
Source = Source2.LanczosResize(704,304).trim(0,161712).SelectRangeEvery(1000,10)

ProcessedClip = AVISource("I:\Ripp\ness.avi").Trim(1,0).BlindPP(cpu2="xxxxoo").SelectRangeEvery(1000,10)
UnProcessedClip = AVISource("I:\Ripp\ness.avi").Trim(1,0).SelectRangeEvery(1000,10)

FstMeasure = ssim(Source,ProcessedClip,"Encode1results.csv","averageSSIM1.txt",lumimask=true)
SndMeasure = ssim(Source,UnProcessedClip,"Encode2results.csv","averageSSIM2.txt",lumimask=true))

return StackVertical(FstMeasure, SndMeasure)
I obtained the following results :

Number of frames where the SSIM value for the postprocessed clip was higher / equal / lower than the the SSIM for other : 1109 / 13 / 498

Mean SSIM for the postprocessed clip : 72.21 ( 76.93 with lumimask = false )
Mean SSIM for the non-postprocessed clip : 71.91 ( 76.64 with lumimask = false )

( I made a test with cpu2 = "xxxxxx", I got 71.53. I also made a test with BilinearResize instead of LanczosResize, and with lumimask off, and I obtained respectively 81.37 and 80.91 )

Moreover, the maximum difference between the two SSIM value was 2.8 in favor of the postprocessed clip, and 1.26 in his defavor. Finally, the mean difference in favor of the postprocessed clip was 0.515, whereas it was 0.235 for the other one.

I visually inspected the portion of the clip where SSIM value where calculated. A higher value for the postprocessed clip is often correlated with the picture having an almost uniform background. At those bitrates, XviD tends to make it "move", but strangely, the deblocking corrects very well this issue. When the SSIM was lower for the postprocessed clip, the difference was hard to spot. In one case ( dark image, with small black and orange strips ), I was able able to see some differences, but not while playing back the clip.

So it confirms that postprocessing does more good than harm at low bitrates ( low for MPEG-4 compliant codecs ). I hope it'll will also help to see how SSIM works, and if we'll be able to use it as a reliable measure of distortion, close to human vision. The next test I'll do will be with the same movie, encoded at a lower resolution.

PS : for the moderators, I'm not sure where this post should go, feel free to move it on XviD's forum if you think it's fitting better there.

MfA
11th October 2003, 16:24
The fact that dark images have a non representative SSIM value is because of how lumimasking is implemented (and it is implemented like it is because we borrowed everything straight from a paper to make sure we werent bollocksing it up). The lumimasking generates a weight, it doesnt actually adapt the SSIM values. So dark images contribute less to the final SSIM result for the clip, but their own SSIM values are still lower than you might expect.

We would really need to setup a framework to test parameter and method changes against the VQEG test sets to be able to change it though ... just changing things to what we think more logical can backfire.

Manao
12th October 2003, 10:32
As I said, I made other tests with encoding at a lower resolution ( 640x272 ), and with different settings in the preprocessing of avisynth.

I made two encodes, the only difference between them was the use of BlindPP(cpu2="xxxxoo") or not.

Edit : I add results with an unfiltered clip, and with a clip filtered by mipsmooth.

I compared the result with playbacking at different resolutions ( 640x272, 704x304, 1024x432, resized with lanczos ) and with or without BlindPP(cpu2="xxxxoo").

*--------------------------*---*---*-----*---*-----*-------*
| Clip measured |640|704|1024 |PP |NoPP | SSIM |
*--------------------------*---*---*-----*---*-----*-------*
| 704x304 clip | x | | | | x | 78.04 |
| 704x304 clip | x | | | x | | 78.34 |
| 640x272 with BPP | x | | | | x | 78.22 |
| 640x272 with BPP | x | | | x | | 78.31 |
| 640x272 without BPP | x | | | | x | 78.38 |
| 640x272 without BPP | x | | | x | | 78.50 |
*--------------------------*---*---*-----*---*-----*-------*
| 704x304 clip | | | x | | x | 74.05 |
| 704x304 clip | | | x | x | | 74.41 |
| 640x272 with BPP | | | x | | x | 74.04 |
| 640x272 with BPP | | | x | x | | 74.24 |
| 640x272 without BPP | | | x | | x | 74.12 |
| 640x272 without BPP | | | x | x | | 74.35 |
| 640x272 unfiltered | | | x | | x | 73.80 |
| 640x272 unfiltered | | | x | x | | 74.17 |
| 640x272 with Mipsmooth | | | x | | x | 72.41 |
| 640x272 with Mipsmooth | | | x | x | | 72.54 |
*--------------------------*---*---*-----*---*-----*-------*
| 704x304 clip | | x | | x | | 76.93 |
| 640x272 with BPP | | x | | x | | 76.66 |
| 640x288 with BPP | | x | | x | | 76.46 |
*--------------------------*---*---*-----*---*-----*-------*
All these values were measured without lumimask ( lumimask = false )

It's hard to comment these values. All I can say is :
- Since the source had a very high quality, so use of BlindPP before encoding was not necessary. SSIM confirms that.
- The 704x304 clip is more helped by the postprocessing than the 640x272 one. I should make a visual inspection of this.
- The anamorphic attempt wasn't conclusive. Since SSIM doesn't take into account the bias between horizontals and verticals in human vision, it's normal.

For the moment, and for this clip only, I like the way SSIM behaves. I'll to do the same tests for the next DVD's I'll ripp. I think I'll also make a last test with this one, to check the influence of the denoising filters in the preprocessing, and to see if I get results correlating those of Wilbert ( see here (http://forum.doom9.org/showthread.php?s=&threadid=62332) )