[XviD-devel] Scenechange detection

Christoph Lampert chl at math.uni-bonn.de
Wed Dec 31 13:05:16 CET 2003

On Wed, 31 Dec 2003, Radek Czyz wrote:
> Now let me think... if the image was 256x196 it had 16x13 macroblocks. 
> The actual p/b/i decision ignores top and left macroblocks (image is not 
> edged yet, motion search there wouldn't work as expected) and takes 4 
> macroblocks at a time (2x2) possibly including right and down 
> macroblocks. This means it checked 14x12, and included one black row at 
> the top and - unfortunately - almost three black rows at the bottom 
> (almost -> one row had 4 pixels of the image, one didn't, and one was 
> also black but mostly outside of picture).
> I'd say that this was the reason... pure black didn't add to SAD but 
> added at least 300 to picture's complexity, and it usually works good 
> this way.

Yes, I think so too. So I rather take this as a side note for further
speedup of first pass: A lower-resolution first pass might not be a good
idea, although, maybe I shouldn't say so, but just test ;-) 

> Ah, the 'wierd' intra frames definitely come from max-keyframe-interval 
> - once we reach 2/3 of allowed non-intra frames, intra threshold drops 
> to reach zero at the right spot. This allows catching any frame that is 
> better at being intra that just a random 300th (or whatever) frame.

Ah, okay, I didn't remember those. Still, it had a strange effect in this
clip. Btw, do those extra keyframes get removed in second pass if a
keyframe within the limit is detected? I think they should, even if the 
overhead is small. 

Btw. for the statistics: This short (non action) 5300 frames part of LOTR2
had 53 real scenechanges, average length of a scene was therefore 100
frames (4 seconds). Max was 379 frames (15 seconds); min was 22
frames (0.9 seconds). 

XviD set 42 keyframes. P-frame at nondetected scenechanges were about 
same size as I-frames, so no gain or loss from this. I-frames at non-scene
changes were of course larger. 

Average framesize of I-frames was 6794, average of Pframes 1657 bytes.


More information about the XviD-devel mailing list